Skip to content

Commit b0904e7

Browse files
Donny9Alan C. Assis
authored andcommitted
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 <dongjiuzhu1@xiaomi.com>
1 parent 5fd1ab8 commit b0904e7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/shm/shm_open.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ static int file_shm_open(FAR struct file *shm, FAR const char *name,
150150

151151
/* Associate the inode with a file structure */
152152

153-
shm->f_oflags = oflags | O_CLOEXEC | O_NOFOLLOW;
153+
shm->f_oflags = oflags | O_NOFOLLOW;
154154
shm->f_inode = inode;
155155

156156
errout_with_sem:
@@ -176,7 +176,7 @@ int shm_open(FAR const char *name, int oflag, mode_t mode)
176176
int ret;
177177
int fd;
178178

179-
fd = file_allocate(oflag, 0, &shm);
179+
fd = file_allocate(oflag | O_CLOEXEC, 0, &shm);
180180
if (fd < 0)
181181
{
182182
set_errno(-fd);

0 commit comments

Comments
 (0)