]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
fix rare race condition that causes infinite loop
authorRoger Dingledine <arma@torproject.org>
Wed, 4 Aug 2004 06:49:17 +0000 (06:49 +0000)
committerRoger Dingledine <arma@torproject.org>
Wed, 4 Aug 2004 06:49:17 +0000 (06:49 +0000)
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.

svn:r2141

src/or/main.c

index 5e27f0072101088908bbec8c8e732510725dee91..8f01b4f31090818ceab50626db5a0127eef6ee56 100644 (file)
@@ -842,7 +842,7 @@ static int do_main_loop(void) {
       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 */