diff options
author | Rich Felker <dalias@aerifal.cx> | 2015-02-04 22:50:40 -0500 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2015-03-30 01:41:34 -0400 |
commit | c534aad07df48a130e342fb78304b80778d53c64 (patch) | |
tree | 092dc5c39cef0e6fd338382027083de5c0839468 /src | |
parent | 35c1939960bf32f2f3e8d40a83c375a0fb85c0de (diff) | |
download | musl-c534aad07df48a130e342fb78304b80778d53c64.tar.gz musl-c534aad07df48a130e342fb78304b80778d53c64.tar.bz2 musl-c534aad07df48a130e342fb78304b80778d53c64.tar.xz musl-c534aad07df48a130e342fb78304b80778d53c64.zip |
fix fd leak race (missing O_CLOEXEC) in fchmodat
(cherry picked from commit 2736eb6caa70bb6e909d7d8ebbe145c2071435e0)
Diffstat (limited to 'src')
-rw-r--r-- | src/stat/fchmodat.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/stat/fchmodat.c b/src/stat/fchmodat.c index 12e7ff0c..94d0335c 100644 --- a/src/stat/fchmodat.c +++ b/src/stat/fchmodat.c @@ -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); |