X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=sidebyside;f=src%2Funistd%2Ffchdir.c;h=dee45ba68e6425a17fe2ef4f4b77038666e43d80;hb=d59e504279abd3f613c2305a65fb16936f7b07f1;hp=e5595f7749f35f0d959da1fc186e6361e648e90d;hpb=aa398f56fa398f2202b04e82c67f822f3233786f;p=musl diff --git a/src/unistd/fchdir.c b/src/unistd/fchdir.c index e5595f77..dee45ba6 100644 --- a/src/unistd/fchdir.c +++ b/src/unistd/fchdir.c @@ -1,7 +1,15 @@ #include +#include +#include #include "syscall.h" int fchdir(int fd) { - return syscall(SYS_fchdir, fd); + int ret = __syscall(SYS_fchdir, fd); + if (ret != -EBADF || __syscall(SYS_fcntl, fd, F_GETFD) < 0) + return __syscall_ret(ret); + + char buf[15+3*sizeof(int)]; + __procfdname(buf, fd); + return syscall(SYS_chdir, buf); }