summaryrefslogtreecommitdiff
path: root/usr.sbin/syslogd/privsep.c
diff options
context:
space:
mode:
authorMarco Pfatschbacher <mpf@cvs.openbsd.org>2008-03-16 15:44:19 +0000
committerMarco Pfatschbacher <mpf@cvs.openbsd.org>2008-03-16 15:44:19 +0000
commitda8d2509bf8f9d317e04899b26333b4229912d09 (patch)
tree5ebcec713ef93ea83b4033474ffd69b1ba83ffbf /usr.sbin/syslogd/privsep.c
parent8ddfa741b5e5447a09ca60a7cc885a3e69c33ee1 (diff)
syslogd leaves zombies around if multiple |/pathto/mylogprog
children died in a row. Do waitpid(2) in a loop until there's nothing left. OK henning@, millert@
Diffstat (limited to 'usr.sbin/syslogd/privsep.c')
-rw-r--r--usr.sbin/syslogd/privsep.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/usr.sbin/syslogd/privsep.c b/usr.sbin/syslogd/privsep.c
index 8ffbdd7c850..13b74e14d5a 100644
--- a/usr.sbin/syslogd/privsep.c
+++ b/usr.sbin/syslogd/privsep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: privsep.c,v 1.30 2007/03/15 05:18:32 djm Exp $ */
+/* $OpenBSD: privsep.c,v 1.31 2008/03/16 15:44:18 mpf Exp $ */
/*
* Copyright (c) 2003 Anil Madhavapeddy <anil@recoil.org>
@@ -753,11 +753,9 @@ sig_got_chld(int sig)
do {
pid = waitpid(WAIT_ANY, NULL, WNOHANG);
- } while (pid == -1 && errno == EINTR);
-
- if (pid == child_pid &&
- cur_state < STATE_QUIT)
- cur_state = STATE_QUIT;
+ if (pid == child_pid && cur_state < STATE_QUIT)
+ cur_state = STATE_QUIT;
+ } while (pid > 0 || (pid == -1 && errno == EINTR));
}
/* Read all data or return 1 for error. */