mirror of https://git.musl-libc.org/git/musl
Browse Source
the linux documentation for dup2 says it can fail with EBUSY due to a race condition with open and dup in the kernel. shield applications (and the rest of libc) from this nonsense by looping until it succeedsrs-1.0
1 changed files with 4 additions and 1 deletions
@ -1,7 +1,10 @@ |
|||
#include <unistd.h> |
|||
#include <errno.h> |
|||
#include "syscall.h" |
|||
|
|||
int dup2(int old, int new) |
|||
{ |
|||
return syscall(SYS_dup2, old, new); |
|||
int r; |
|||
while ((r=__syscall(SYS_dup2, old, new))==-EBUSY); |
|||
return __syscall_ret(r); |
|||
} |
|||
|
|||
Loading…
Reference in new issue