From d5bd7dd5d2780ce715e985e8f66b44f80e64f485 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Fri, 18 Oct 2013 07:12:38 -0400 Subject: [PATCH] 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. --- src/unistd/faccessat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.25.1