X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fdirent%2Ffdopendir.c;h=d78fb87f9bc909dcbf4a81a779a76dcb89696b17;hb=c5d118ebbcfe41d928d8ffc913bc532c59237189;hp=c377271da53919acb39f5929ded9d77f874f7e55;hpb=571744447c23f91feb6439948f3a619aca850dfb;p=musl diff --git a/src/dirent/fdopendir.c b/src/dirent/fdopendir.c index c377271d..d78fb87f 100644 --- a/src/dirent/fdopendir.c +++ b/src/dirent/fdopendir.c @@ -13,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;