|
|
@@ -2392,13 +2392,8 @@ static void kwsysProcessKill(pid_t process_id)
|
|
|
DIR* procdir;
|
|
|
#endif
|
|
|
|
|
|
- /* 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);
|
|
|
+ /* Suspend the process to be sure it will not create more children. */
|
|
|
+ kill(process_id, SIGSTOP);
|
|
|
|
|
|
/* Kill all children if we can find them. */
|
|
|
#if defined(__linux__) || defined(__CYGWIN__)
|
|
|
@@ -2486,6 +2481,19 @@ static void kwsysProcessKill(pid_t process_id)
|
|
|
}
|
|
|
#endif
|
|
|
}
|
|
|
+
|
|
|
+ /* Kill the process. */
|
|
|
+ kill(process_id, SIGKILL);
|
|
|
+
|
|
|
+#if defined(__APPLE__)
|
|
|
+ /* On OS X 10.3 the above SIGSTOP occasionally prevents the SIGKILL
|
|
|
+ from working. Just in case, we resume the child and kill it
|
|
|
+ again. There is a small race condition in this obscure case. If
|
|
|
+ the child manages to fork again between these two signals, we
|
|
|
+ will not catch its children. */
|
|
|
+ kill(process_id, SIGCONT);
|
|
|
+ kill(process_id, SIGKILL);
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
/*--------------------------------------------------------------------------*/
|