Merge pull request #161 from tabraham/master

lib/spawn.c run_command: don't loop forever if waitpid() is returning ECHILD
This commit is contained in:
Christian Brauner 2019-06-04 13:31:08 +02:00 committed by GitHub
commit a5f034f272
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -68,6 +68,8 @@ int run_command (const char *cmd, const char *argv[],
do { do {
wpid = waitpid (pid, status, 0); wpid = waitpid (pid, status, 0);
if ((pid_t)-1 == wpid && errno == ECHILD)
break;
} while ( ((pid_t)-1 == wpid && errno == EINTR) } while ( ((pid_t)-1 == wpid && errno == EINTR)
|| ((pid_t)-1 != wpid && wpid != pid)); || ((pid_t)-1 != wpid && wpid != pid));