mirror of
https://github.com/fluencelabs/musl
synced 2025-06-27 13:41:57 +00:00
fix errno value when fdopendir is given an invalid file descriptor
this resolves an issue reported by Vasiliy Kulikov
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user