X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fdirent%2Ffdopendir.c;h=d78fb87f9bc909dcbf4a81a779a76dcb89696b17;hb=c5d118ebbcfe41d928d8ffc913bc532c59237189;hp=c684a866a3079d1d46a1d403615c4568a9713249;hpb=fa845669ce03c26c069fc34e7377b47fac23edd8;p=musl diff --git a/src/dirent/fdopendir.c b/src/dirent/fdopendir.c index c684a866..d78fb87f 100644 --- a/src/dirent/fdopendir.c +++ b/src/dirent/fdopendir.c @@ -3,8 +3,6 @@ #include #include #include -#include -#include #include "__dirent.h" DIR *fdopendir(int fd) @@ -15,6 +13,10 @@ DIR *fdopendir(int fd) if (fstat(fd, &st) < 0) { return 0; } + if (fcntl(fd, F_GETFL) & O_PATH) { + errno = EBADF; + return 0; + } if (!S_ISDIR(st.st_mode)) { errno = ENOTDIR; return 0;