diff options
Diffstat (limited to 'src/unistd/dup3.c')
-rw-r--r-- | src/unistd/dup3.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/unistd/dup3.c b/src/unistd/dup3.c index 1f7134b3..0eb6caf5 100644 --- a/src/unistd/dup3.c +++ b/src/unistd/dup3.c @@ -8,6 +8,7 @@ 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 +16,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); } |