提交 fa845669 编写于 作者: R Rich Felker

fix errno value when fdopendir is given an invalid file descriptor

this resolves an issue reported by Vasiliy Kulikov
上级 4ec07e1f
...@@ -12,7 +12,10 @@ DIR *fdopendir(int fd) ...@@ -12,7 +12,10 @@ DIR *fdopendir(int fd)
DIR *dir; DIR *dir;
struct stat st; 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; errno = ENOTDIR;
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册