X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Funistd%2Fdup3.c;h=f919f79125a624c4d47c1cb50a103f82e0ba576f;hb=7634101069db26b003adeec09c6aa14646363557;hp=1f7134b3dcbf7ea16390b543f38798c4b33549b0;hpb=892cafff665b44d238e3b664f61ca38dd965cba6;p=musl diff --git a/src/unistd/dup3.c b/src/unistd/dup3.c index 1f7134b3..f919f791 100644 --- a/src/unistd/dup3.c +++ b/src/unistd/dup3.c @@ -3,11 +3,11 @@ #include #include #include "syscall.h" -#include "libc.h" int __dup3(int old, int new, int flags) { int r; +#ifdef SYS_dup2 if (old==new) return __syscall_ret(-EINVAL); if (flags & O_CLOEXEC) { while ((r=__syscall(SYS_dup3, old, new, flags))==-EBUSY); @@ -15,6 +15,9 @@ int __dup3(int old, int new, int flags) } while ((r=__syscall(SYS_dup2, old, new))==-EBUSY); if (flags & O_CLOEXEC) __syscall(SYS_fcntl, new, F_SETFD, FD_CLOEXEC); +#else + while ((r=__syscall(SYS_dup3, old, new, flags))==-EBUSY); +#endif return __syscall_ret(r); }