casaroli commented on code in PR #21530:
URL: https://github.com/apache/nuttx/pull/21530#discussion_r4500526468


##########
fs/inode/fs_files.c:
##########
@@ -797,9 +797,13 @@ int fdlist_copy(FAR struct fdlist *plist, FAR struct 
fdlist *clist,
               return ret;
             }
 
-          /* Assign filep to the child's descriptor list. Omit the flags */
+          /* Assign filep to the child's descriptor list.  A fork() child
+           * keeps the close-on-exec flag of each descriptor (POSIX); the
+           * descriptors that exec() and posix_spawn() keep have none.
+           */
 
-          fdlist_install(clist, fd, filep, fdp, 0, true);
+          fdlist_install(clist, fd, filep, fdp,
+                         !cloexec && fdp->f_cloexec ? O_CLOEXEC : 0, true);

Review Comment:
   Done.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to