summaryrefslogtreecommitdiff
path: root/src
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
parente8dbf00a789e3b56ca6c3d88e8048b7b2c18b797 (diff)
downloadmusl-f937031800e3130b3b4bb42d0d547bb69a5d32db.tar.gz
optimize opendir using O_CLOEXEC
Diffstat (limited to 'src')
-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;