about summary refs log tree commit diff
path: root/src/dirent/fdopendir.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dirent/fdopendir.c')
-rw-r--r--src/dirent/fdopendir.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/dirent/fdopendir.c b/src/dirent/fdopendir.c
index c377271d..d78fb87f 100644
--- a/src/dirent/fdopendir.c
+++ b/src/dirent/fdopendir.c
@@ -13,6 +13,10 @@ DIR *fdopendir(int fd)
 	if (fstat(fd, &st) < 0) {
 		return 0;
 	}
+	if (fcntl(fd, F_GETFL) & O_PATH) {
+		errno = EBADF;
+		return 0;
+	}
 	if (!S_ISDIR(st.st_mode)) {
 		errno = ENOTDIR;
 		return 0;