summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/opendir.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/gen/opendir.c')
-rw-r--r--lib/libc/gen/opendir.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libc/gen/opendir.c b/lib/libc/gen/opendir.c
index 4366399..2d505fc 100644
--- a/lib/libc/gen/opendir.c
+++ b/lib/libc/gen/opendir.c
@@ -199,7 +199,8 @@ __opendir_common(int fd, const char *name, int flags)
* which has also been read -- see fts.c.
*/
if (flags & DTF_REWIND) {
- if ((fd2 = _open(name, O_RDONLY | O_DIRECTORY)) == -1) {
+ if ((fd2 = _open(name, O_RDONLY | O_DIRECTORY |
+ O_CLOEXEC)) == -1) {
saved_errno = errno;
free(buf);
free(dirp);
OpenPOWER on IntegriCloud