diff options
author | Rich Felker <dalias@aerifal.cx> | 2015-02-04 22:50:40 -0500 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2015-02-04 22:50:40 -0500 |
commit | 2736eb6caa70bb6e909d7d8ebbe145c2071435e0 (patch) | |
tree | 29bd6c6840aebb2f827f8a6d2a970bc9dfde077e | |
parent | 14a0117117beed9d54d17819d9a9c3d4200c46ed (diff) | |
download | musl-2736eb6caa70bb6e909d7d8ebbe145c2071435e0.tar.gz musl-2736eb6caa70bb6e909d7d8ebbe145c2071435e0.tar.xz musl-2736eb6caa70bb6e909d7d8ebbe145c2071435e0.zip |
fix fd leak race (missing O_CLOEXEC) in fchmodat
-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 afa6d44b..a894cb69 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); |