[cmake-commits] king committed ProcessUNIX.c 1.68 1.69

cmake-commits at cmake.org cmake-commits at cmake.org
Wed May 16 13:10:47 EDT 2007


Update of /cvsroot/CMake/CMake/Source/kwsys
In directory public:/mounts/ram/cvs-serv17564

Modified Files:
	ProcessUNIX.c 
Log Message:
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.


Index: ProcessUNIX.c
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/ProcessUNIX.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- ProcessUNIX.c	3 May 2007 17:03:13 -0000	1.68
+++ ProcessUNIX.c	16 May 2007 17:10:45 -0000	1.69
@@ -2312,8 +2312,13 @@
   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 @@
       }
 #endif
     }
-
-  /* Kill the process.  */
-  kill(process_id, SIGKILL);
 }
 
 /*--------------------------------------------------------------------------*/



More information about the Cmake-commits mailing list