From d6778909e9cdd68d29f193edbed7449ce8f9dc9b Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Wed, 4 Aug 2004 06:49:17 +0000 Subject: [PATCH] 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. svn:r2141 --- trunk/src/or/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trunk/src/or/main.c b/trunk/src/or/main.c index 5e27f00721..8f01b4f310 100644 --- a/trunk/src/or/main.c +++ b/trunk/src/or/main.c @@ -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 */