summaryrefslogtreecommitdiff
path: root/usr.sbin/inetd/inetd.c
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2004-09-06 07:03:09 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2004-09-06 07:03:09 +0000
commit933f91909c6c33c40d6a8df83a5f95a124a18f84 (patch)
tree6901ae2a4025482805b6f4936c6253a9cba34dc0 /usr.sbin/inetd/inetd.c
parent4b9b10e14d290287c051852e5013aaec60e8f5a4 (diff)
Reset signal mask in the rate limiting case; check for interrupted
waits. Fixes zombies getting reaped late and other ignored signals. Reported by mpech@; fix by millert@ with help from me. Commit requested by deraadt@. ok mpech@
Diffstat (limited to 'usr.sbin/inetd/inetd.c')
-rw-r--r--usr.sbin/inetd/inetd.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c
index 28893a7b21a..ca5492688c9 100644
--- a/usr.sbin/inetd/inetd.c
+++ b/usr.sbin/inetd/inetd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inetd.c,v 1.119 2004/07/28 13:08:19 millert Exp $ */
+/* $OpenBSD: inetd.c,v 1.120 2004/09/06 07:03:08 otto Exp $ */
/*
* Copyright (c) 1983,1991 The Regents of the University of California.
@@ -37,7 +37,7 @@ char copyright[] =
#ifndef lint
/*static const char sccsid[] = "from: @(#)inetd.c 5.30 (Berkeley) 6/3/91";*/
-static const char rcsid[] = "$OpenBSD: inetd.c,v 1.119 2004/07/28 13:08:19 millert Exp $";
+static const char rcsid[] = "$OpenBSD: inetd.c,v 1.120 2004/09/06 07:03:08 otto Exp $";
#endif /* not lint */
/*
@@ -493,7 +493,7 @@ main(int argc, char *argv[])
} else
ctrl = sep->se_fd;
(void) sigprocmask(SIG_BLOCK, &blockmask, NULL);
- spawn(sep, ctrl);
+ spawn(sep, ctrl); /* spawn will unblock */
}
}
}
@@ -629,9 +629,11 @@ doreap(void)
fprintf(stderr, "reaping asked for\n");
for (;;) {
- pid = wait3(&status, WNOHANG, NULL);
- if (pid <= 0)
+ if ((pid = wait3(&status, WNOHANG, NULL)) <= 0) {
+ if (pid == -1 && errno == EINTR)
+ continue;
break;
+ }
if (debug)
fprintf(stderr, "%ld reaped, status %x\n",
(long)pid, status);
@@ -1886,6 +1888,8 @@ spawn(struct servtab *sep, int ctrl)
* Simply ignore the connection.
*/
--sep->se_count;
+ sigprocmask(SIG_SETMASK, &emptymask,
+ NULL);
return;
}
syslog(LOG_ERR,