提交 f9a6372a 编写于 作者: R Rich Felker

workaround bug in linux dup2

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 succeeds
上级 10d7561d
#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);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册