projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix integer overflow in elf.h macro SHF_EXCLUDE
[musl]
/
src
/
dirent
/
fdopendir.c
diff --git
a/src/dirent/fdopendir.c
b/src/dirent/fdopendir.c
index
c4b8e61
..
c377271
100644
(file)
--- a/
src/dirent/fdopendir.c
+++ b/
src/dirent/fdopendir.c
@@
-3,8
+3,6
@@
#include <sys/stat.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <errno.h>
#include <stdlib.h>
-#include <unistd.h>
-#include <limits.h>
#include "__dirent.h"
DIR *fdopendir(int fd)
#include "__dirent.h"
DIR *fdopendir(int fd)
@@
-12,7
+10,10
@@
DIR *fdopendir(int fd)
DIR *dir;
struct stat st;
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;
}
errno = ENOTDIR;
return 0;
}