mirror of
git://git.musl-libc.org/musl
synced 2025-01-27 09:03:59 +00:00
fix fd leak race (missing O_CLOEXEC) in fchmodat
This commit is contained in:
parent
14a0117117
commit
2736eb6caa
@ -21,7 +21,7 @@ int fchmodat(int fd, const char *path, mode_t mode, int flag)
|
||||
if (S_ISLNK(st.st_mode))
|
||||
return __syscall_ret(-EOPNOTSUPP);
|
||||
|
||||
if ((fd2 = __syscall(SYS_openat, fd, path, O_RDONLY|O_PATH|O_NOFOLLOW|O_NOCTTY)) < 0) {
|
||||
if ((fd2 = __syscall(SYS_openat, fd, path, O_RDONLY|O_PATH|O_NOFOLLOW|O_NOCTTY|O_CLOEXEC)) < 0) {
|
||||
if (fd2 == -ELOOP)
|
||||
return __syscall_ret(-EOPNOTSUPP);
|
||||
return __syscall_ret(fd2);
|
||||
|
Loading…
Reference in New Issue
Block a user