[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] fix rare race condition that causes infinite loop



Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or

Modified Files:
	main.c 
Log Message:
fix rare race condition that causes infinite loop

if we get a sigchld but all our children are gone by the time we get
around to reaping them (i don't think this should ever happen, but it
just did), then we'd loop forever trying to reap them.


Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.308
retrieving revision 1.309
diff -u -d -r1.308 -r1.309
--- main.c	4 Aug 2004 04:58:30 -0000	1.308
+++ main.c	4 Aug 2004 06:49:17 -0000	1.309
@@ -842,7 +842,7 @@
       please_reset = 0;
     }
     if(please_reap_children) {
-      while(waitpid(-1,NULL,WNOHANG)) ; /* keep reaping until no more zombies */
+      while(waitpid(-1,NULL,WNOHANG) > 0) ; /* keep reaping until no more zombies */
       please_reap_children = 0;
     }
 #endif /* signal stuff */