X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Funistd%2Ffchdir.c;h=72c3915eee095964e0f161183ccfcff28862a47a;hb=b76d4e06f1686337713a31a9e7274e1321ae41b6;hp=9fbc815429e43973311b3cab56ab298224ec1b0a;hpb=9ca1f62b0c0d3e50480eb654ac941ff943ce0558;p=musl diff --git a/src/unistd/fchdir.c b/src/unistd/fchdir.c index 9fbc8154..72c3915e 100644 --- a/src/unistd/fchdir.c +++ b/src/unistd/fchdir.c @@ -1,5 +1,6 @@ #include #include +#include #include "syscall.h" void __procfdname(char *, unsigned); @@ -7,7 +8,8 @@ void __procfdname(char *, unsigned); int fchdir(int fd) { int ret = __syscall(SYS_fchdir, fd); - if (ret != -EBADF || fd < 0) return __syscall_ret(ret); + if (ret != -EBADF || __syscall(SYS_fcntl, fd, F_GETFD) < 0) + return __syscall_ret(ret); char buf[15+3*sizeof(int)]; __procfdname(buf, fd);