unix: retry waitpid() on EINTR
Before this commit, libuv would abort() if waitpid() failed with EINTR. It's unlikely that anyone actually hit this error condition: the major UNIX platforms - with the possible exception of Solaris - don't return EINTR when the WNOHANG flag is specified, as libuv does. However, POSIX allows for an implementation to do whatever here: unless explicitly forbidden, it's allowed and POSIX doesn't restrict implementers in this particular area. Let's opt for robustness and handle EINTR.
This commit is contained in:
parent
2744e1e009
commit
b2ac4d3bf4
@ -73,7 +73,9 @@ static void uv__chld(uv_signal_t* handle, int signum) {
|
||||
assert(signum == SIGCHLD);
|
||||
|
||||
for (;;) {
|
||||
pid = waitpid(-1, &status, WNOHANG);
|
||||
do
|
||||
pid = waitpid(-1, &status, WNOHANG);
|
||||
while (pid == -1 && errno == EINTR);
|
||||
|
||||
if (pid == 0)
|
||||
return;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user