From: Rich Felker Date: Fri, 18 Oct 2013 11:12:38 +0000 (-0400) Subject: in faccessat slow path, add close-on-exec to pipe fds X-Git-Tag: v0.9.15~90 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d5bd7dd5d2780ce715e985e8f66b44f80e64f485;p=oweals%2Fmusl.git in faccessat slow path, add close-on-exec to pipe fds as usual, this is needed to avoid fd leaks. as a better solution, the use of fds could possibly be replaced with mmap and a futex. --- diff --git a/src/unistd/faccessat.c b/src/unistd/faccessat.c index 1083467f..821e13f5 100644 --- a/src/unistd/faccessat.c +++ b/src/unistd/faccessat.c @@ -34,7 +34,7 @@ int faccessat(int fd, const char *filename, int amode, int flag) sigset_t set; int ret, p[2]; - if (pipe(p)) return __syscall_ret(-EBUSY); + if (pipe2(p, O_CLOEXEC)) return __syscall_ret(-EBUSY); struct ctx c = { .fd = fd, .filename = filename, .amode = amode, .p = p[1] }; __block_all_sigs(&set);