From 8489a94101acc70cf58a12f4478bd49233601839 Mon Sep 17 00:00:00 2001 From: Brad King Date: Sat, 31 Dec 2005 12:59:31 -0500 Subject: BUG: When more than one command is given and one of them fails to start and the rest are killed, do not forget to reap the killed children. --- Source/kwsys/ProcessUNIX.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c index 4380b24..ff65474 100644 --- a/Source/kwsys/ProcessUNIX.c +++ b/Source/kwsys/ProcessUNIX.c @@ -1187,11 +1187,17 @@ static void kwsysProcessCleanup(kwsysProcess* cp, int error) /* Kill any children already started. */ if(cp->ForkPIDs) { + int status; for(i=0; i < cp->NumberOfCommands; ++i) { if(cp->ForkPIDs[i]) { + /* Kill the child. */ kwsysProcessKill(cp->ForkPIDs[i]); + /* Reap the child. Keep trying until the call is not + interrupted. */ + while((waitpid(cp->ForkPIDs[i], &status, 0) < 0) && + (errno == EINTR)); } } } -- cgit v0.12