about summary refs log tree commit diff
path: root/src/dirent
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-06-25 01:38:25 -0400
committerRich Felker <dalias@aerifal.cx>2011-06-25 01:38:25 -0400
commitf937031800e3130b3b4bb42d0d547bb69a5d32db (patch)
treed9d8a01d07fd1042dfb8e8459e9e811fa4b39266 /src/dirent
parente8dbf00a789e3b56ca6c3d88e8048b7b2c18b797 (diff)
downloadmusl-f937031800e3130b3b4bb42d0d547bb69a5d32db.tar.gz
musl-f937031800e3130b3b4bb42d0d547bb69a5d32db.tar.xz
musl-f937031800e3130b3b4bb42d0d547bb69a5d32db.zip
optimize opendir using O_CLOEXEC
Diffstat (limited to 'src/dirent')
-rw-r--r--src/dirent/opendir.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/dirent/opendir.c b/src/dirent/opendir.c
index 928742c0..d33d8928 100644
--- a/src/dirent/opendir.c
+++ b/src/dirent/opendir.c
@@ -14,9 +14,8 @@ DIR *opendir(const char *name)
 	int fd;
 	DIR *dir;
 
-	if ((fd = open(name, O_RDONLY|O_DIRECTORY)) < 0)
+	if ((fd = open(name, O_RDONLY|O_DIRECTORY|O_CLOEXEC)) < 0)
 		return 0;
-	fcntl(fd, F_SETFD, FD_CLOEXEC);
 	if (!(dir = calloc(1, sizeof *dir))) {
 		__syscall(SYS_close, fd);
 		return 0;