summaryrefslogtreecommitdiffstats
path: root/libc/misc/dirent/opendir.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/misc/dirent/opendir.c')
-rw-r--r--libc/misc/dirent/opendir.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/libc/misc/dirent/opendir.c b/libc/misc/dirent/opendir.c
index c2e008a3a..4a23ab061 100644
--- a/libc/misc/dirent/opendir.c
+++ b/libc/misc/dirent/opendir.c
@@ -82,11 +82,6 @@ DIR *opendir(const char *name)
}
# define O_DIRECTORY 0
#endif
-
-#ifndef O_CLOEXEC
-# define O_CLOEXEC 0
-#endif
-
fd = open_not_cancel_2(name, O_RDONLY|O_NDELAY|O_DIRECTORY|O_CLOEXEC);
if (fd < 0)
return NULL;
@@ -107,8 +102,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_not_cancel(fd, F_SETFD, FD_CLOEXEC);
+#endif
ptr = fd_to_DIR(fd, statbuf.st_blksize);