This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 767c8ea6c uorb: enable O_CLOEXEC explicit
767c8ea6c is described below

commit 767c8ea6ceee540e903e1ef24114024461c81fb8
Author: wanggang26 <[email protected]>
AuthorDate: Fri Oct 27 16:33:34 2023 +0800

    uorb: enable O_CLOEXEC explicit
    
    to avoid potential fd leak which means fork/vfork will duplicate fd
    without O_CLOEXEC flag to the child process.
    
    Signed-off-by: wanggang26 <[email protected]>
---
 system/uorb/uORB/uORB.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/system/uorb/uORB/uORB.c b/system/uorb/uORB/uORB.c
index e8f3e6d95..20d6e1157 100644
--- a/system/uorb/uORB/uORB.c
+++ b/system/uorb/uORB/uORB.c
@@ -75,7 +75,7 @@ static int orb_advsub_open(FAR const struct orb_metadata 
*meta, int flags,
       reginfo.nbuffer = queue_size;
       reginfo.persist = !!(flags & SENSOR_PERSIST);
 
-      fd = open(ORB_USENSOR_PATH, O_WRONLY);
+      fd = open(ORB_USENSOR_PATH, O_WRONLY | O_CLOEXEC);
       if (fd < 0)
         {
           return fd;

Reply via email to