diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/gen/opendir.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/gen/opendir.c b/lib/libc/gen/opendir.c index b312c89..0c08735 100644 --- a/lib/libc/gen/opendir.c +++ b/lib/libc/gen/opendir.c @@ -86,7 +86,7 @@ __opendir2(const char *name, int flags) errno = ENOTDIR; return (NULL); } - if ((fd = _open(name, O_RDONLY | O_NONBLOCK)) == -1) + if ((fd = _open(name, O_RDONLY | O_NONBLOCK | O_DIRECTORY)) == -1) return (NULL); return __opendir_common(fd, name, flags); @@ -200,7 +200,7 @@ __opendir_common(int fd, const char *name, int flags) */ if (flags & DTF_REWIND) { (void)_close(fd); - if ((fd = _open(name, O_RDONLY)) == -1) { + if ((fd = _open(name, O_RDONLY | O_DIRECTORY)) == -1) { saved_errno = errno; free(buf); free(dirp); |