summaryrefslogtreecommitdiff
path: root/libc/misc/dirent
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-10-07 22:51:55 -0400
committerMike Frysinger <vapier@gentoo.org>2009-10-07 22:53:39 -0400
commitb8f1f91cc6d7b579fdb2370ab046565f9930aa09 (patch)
treef4bed1003ca36419f344d5540fa1cd32da220518 /libc/misc/dirent
parent49b5ce384740ebabfc8e38dff6e37913e224dd29 (diff)
clean up O_CLOEXEC handling
Drop the "#ifndef O_CLOEXEC" cruft, enable O_CLOEXEC in most fcntl.h headers, and import __ASSUME_O_CLOEXEC from glibc. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'libc/misc/dirent')
-rw-r--r--libc/misc/dirent/opendir.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/libc/misc/dirent/opendir.c b/libc/misc/dirent/opendir.c
index e85dd3003..b43f60814 100644
--- a/libc/misc/dirent/opendir.c
+++ b/libc/misc/dirent/opendir.c
@@ -81,9 +81,6 @@ DIR *opendir(const char *name)
}
# define O_DIRECTORY 0
#endif
-#ifndef O_CLOEXEC
-# define O_CLOEXEC 0
-#endif
fd = open(name, O_RDONLY|O_NDELAY|O_DIRECTORY|O_CLOEXEC);
if (fd < 0)
return NULL;
@@ -104,8 +101,9 @@ DIR *opendir(const char *name)
/* According to POSIX, directory streams should be closed when
* exec. From "Anna Pluzhnikov" <besp@midway.uchicago.edu>.
*/
- if (O_CLOEXEC == 0)
- fcntl(fd, F_SETFD, FD_CLOEXEC);
+#ifndef __ASSUME_O_CLOEXEC
+ fcntl(fd, F_SETFD, FD_CLOEXEC);
+#endif
ptr = fd_to_DIR(fd, statbuf.st_blksize);
if (!ptr) {