summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2010-03-21 20:45:06 +0000
committered <ed@FreeBSD.org>2010-03-21 20:45:06 +0000
commit11f35d5f2444a6dff8d008f65852b7922a8bb043 (patch)
treec47841b231fbad470c30973b7c0e4be285c0576d /lib
parent61565034678feb77b6c58414a124a3e2da5b51e7 (diff)
downloadFreeBSD-src-11f35d5f2444a6dff8d008f65852b7922a8bb043.zip
FreeBSD-src-11f35d5f2444a6dff8d008f65852b7922a8bb043.tar.gz
Let opendir() use O_DIRECTORY.
I am not removing the fstat() calls here, since we cannot yet assume people will always run kernels that respect O_DIRECTORY.
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/opendir.c4
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);
OpenPOWER on IntegriCloud