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

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

commit b0904e7c399c1003be30301183d942779ea45fd9
Author: dongjiuzhu1 <dongjiuz...@xiaomi.com>
AuthorDate: Sun Jun 15 00:10:13 2025 +0800

    fs/shm: add O_CLOEXEC when allocate new struct fd to avoid lost flags.
    
    fix bug about ltp_interfaces_shm_open_11_1
    
    Signed-off-by: dongjiuzhu1 <dongjiuz...@xiaomi.com>
---
 fs/shm/shm_open.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/shm/shm_open.c b/fs/shm/shm_open.c
index cad2b97683..4c70187004 100644
--- a/fs/shm/shm_open.c
+++ b/fs/shm/shm_open.c
@@ -150,7 +150,7 @@ static int file_shm_open(FAR struct file *shm, FAR const 
char *name,
 
   /* Associate the inode with a file structure */
 
-  shm->f_oflags = oflags | O_CLOEXEC | O_NOFOLLOW;
+  shm->f_oflags = oflags | O_NOFOLLOW;
   shm->f_inode = inode;
 
 errout_with_sem:
@@ -176,7 +176,7 @@ int shm_open(FAR const char *name, int oflag, mode_t mode)
   int ret;
   int fd;
 
-  fd = file_allocate(oflag, 0, &shm);
+  fd = file_allocate(oflag | O_CLOEXEC, 0, &shm);
   if (fd < 0)
     {
       set_errno(-fd);

Reply via email to