projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4ec07e1
)
fix errno value when fdopendir is given an invalid file descriptor
author
Rich Felker
<dalias@aerifal.cx>
Fri, 22 Jul 2011 01:15:14 +0000
(21:15 -0400)
committer
Rich Felker
<dalias@aerifal.cx>
Fri, 22 Jul 2011 01:15:14 +0000
(21:15 -0400)
this resolves an issue reported by Vasiliy Kulikov
src/dirent/fdopendir.c
patch
|
blob
|
history
diff --git
a/src/dirent/fdopendir.c
b/src/dirent/fdopendir.c
index c4b8e61d2a53a73b5eb5b34c6e7d48df1720b507..c684a866a3079d1d46a1d403615c4568a9713249 100644
(file)
--- 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;
}