diff options
author | Rich Felker <dalias@aerifal.cx> | 2011-06-25 01:38:25 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2011-06-25 01:38:25 -0400 |
commit | f937031800e3130b3b4bb42d0d547bb69a5d32db (patch) | |
tree | d9d8a01d07fd1042dfb8e8459e9e811fa4b39266 /src/dirent | |
parent | e8dbf00a789e3b56ca6c3d88e8048b7b2c18b797 (diff) | |
download | musl-f937031800e3130b3b4bb42d0d547bb69a5d32db.tar.gz musl-f937031800e3130b3b4bb42d0d547bb69a5d32db.tar.bz2 musl-f937031800e3130b3b4bb42d0d547bb69a5d32db.tar.xz musl-f937031800e3130b3b4bb42d0d547bb69a5d32db.zip |
optimize opendir using O_CLOEXEC
Diffstat (limited to 'src/dirent')
-rw-r--r-- | src/dirent/opendir.c | 3 |
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; |