From: Thomas Abraham Date: Mon, 6 May 2019 18:26:14 +0000 (-0400) Subject: lib/spawn.c run_command: don't loop forever if waitpid() is returning ECHILD X-Git-Tag: 4.7~3^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F161%2Fhead;p=thirdparty%2Fshadow.git 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. --- diff --git a/lib/spawn.c b/lib/spawn.c index fc4ad95c7..d0b5fb26e 100644 --- a/lib/spawn.c +++ b/lib/spawn.c @@ -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));