diff options
author | Brad King <brad.king@kitware.com> | 2005-12-31 17:59:31 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2005-12-31 17:59:31 (GMT) |
commit | 8489a94101acc70cf58a12f4478bd49233601839 (patch) | |
tree | d3b75338603843ed9ba5ccf4982c304a8316ec5a /Source | |
parent | ccae106177c5adf87b61d14952296ea6505b4a64 (diff) | |
download | CMake-8489a94101acc70cf58a12f4478bd49233601839.zip CMake-8489a94101acc70cf58a12f4478bd49233601839.tar.gz CMake-8489a94101acc70cf58a12f4478bd49233601839.tar.bz2 |
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.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/kwsys/ProcessUNIX.c | 6 |
1 files changed, 6 insertions, 0 deletions
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)); } } } |