lib/spawn.c run_command: don't loop forever if waitpid() is returning ECHILD
If SIGCHILD is being ignored, waitpid() will forever error with ECHILD and this loop with never end, so don't loop if it errors with ECHILD.
This commit is contained in:
parent
8d39357c84
commit
82fa6eccf9
@ -68,6 +68,8 @@ int run_command (const char *cmd, const char *argv[],
|
||||
|
||||
do {
|
||||
wpid = waitpid (pid, status, 0);
|
||||
if ((pid_t)-1 == wpid && errno == ECHILD)
|
||||
break;
|
||||
} while ( ((pid_t)-1 == wpid && errno == EINTR)
|
||||
|| ((pid_t)-1 != wpid && wpid != pid));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user