about summary refs log tree commit diff
path: root/src/unistd
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2013-10-18 07:12:38 -0400
committerRich Felker <dalias@aerifal.cx>2013-10-18 07:12:38 -0400
commitd5bd7dd5d2780ce715e985e8f66b44f80e64f485 (patch)
tree5c5efeba7ec32737adc11e4c5984b4be6caf14c9 /src/unistd
parent516358561efbc5754d0ad43a52483e0a839d6bd3 (diff)
downloadmusl-d5bd7dd5d2780ce715e985e8f66b44f80e64f485.tar.gz
musl-d5bd7dd5d2780ce715e985e8f66b44f80e64f485.tar.xz
musl-d5bd7dd5d2780ce715e985e8f66b44f80e64f485.zip
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.
Diffstat (limited to 'src/unistd')
-rw-r--r--src/unistd/faccessat.c2
1 files changed, 1 insertions, 1 deletions
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);