summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2005-12-31 17:59:31 (GMT)
committerBrad King <brad.king@kitware.com>2005-12-31 17:59:31 (GMT)
commit8489a94101acc70cf58a12f4478bd49233601839 (patch)
treed3b75338603843ed9ba5ccf4982c304a8316ec5a /Source
parentccae106177c5adf87b61d14952296ea6505b4a64 (diff)
downloadCMake-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.c6
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));
}
}
}