diff options
author | Brad King <brad.king@kitware.com> | 2007-05-16 17:10:45 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2007-05-16 17:10:45 (GMT) |
commit | 01c7db07c3826c05c658a370cd0d42bf3128fcff (patch) | |
tree | f2cdcf90c29aa520184dbbec6b5da218c4250281 | |
parent | b384218ec10c18f19bbbc83cc4d5b1ac804debb7 (diff) | |
download | CMake-01c7db07c3826c05c658a370cd0d42bf3128fcff.zip CMake-01c7db07c3826c05c658a370cd0d42bf3128fcff.tar.gz CMake-01c7db07c3826c05c658a370cd0d42bf3128fcff.tar.bz2 |
BUG: Do not send both SIGSTOP and SIGKILL when killing a process. The SIGSTOP seems to be able to block the SIGKILL occasionally. Also the SIGKILL is sufficient since the process table entry will still exist until it is reaped with waitpid.
-rw-r--r-- | Source/kwsys/ProcessUNIX.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c index 9917e50..bc24fc6 100644 --- a/Source/kwsys/ProcessUNIX.c +++ b/Source/kwsys/ProcessUNIX.c @@ -2312,8 +2312,13 @@ static void kwsysProcessKill(pid_t process_id) DIR* procdir; #endif - /* Suspend the process to be sure it will not create more children. */ - kill(process_id, SIGSTOP); + /* Kill the process now to make sure it does not create more + children. Do not reap it yet so we can identify its existing + children. There is a small race condition here. If the child + forks after we begin looking for children below but before it + receives this kill signal we might miss a child. Also we might + not be able to catch up to a fork bomb. */ + kill(process_id, SIGKILL); /* Kill all children if we can find them. */ #if defined(__linux__) || defined(__CYGWIN__) @@ -2401,9 +2406,6 @@ static void kwsysProcessKill(pid_t process_id) } #endif } - - /* Kill the process. */ - kill(process_id, SIGKILL); } /*--------------------------------------------------------------------------*/ |