summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dirent/fdopendir.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/dirent/fdopendir.c b/src/dirent/fdopendir.c
index c4b8e61d..c684a866 100644
--- a/src/dirent/fdopendir.c
+++ b/src/dirent/fdopendir.c
@@ -12,7 +12,10 @@ DIR *fdopendir(int fd)
DIR *dir;
struct stat st;
- if (fstat(fd, &st) < 0 || !S_ISDIR(st.st_mode)) {
+ if (fstat(fd, &st) < 0) {
+ return 0;
+ }
+ if (!S_ISDIR(st.st_mode)) {
errno = ENOTDIR;
return 0;
}