diff options
author | sheldonh <sheldonh@FreeBSD.org> | 1999-07-21 16:09:45 +0000 |
---|---|---|
committer | sheldonh <sheldonh@FreeBSD.org> | 1999-07-21 16:09:45 +0000 |
commit | cd7ecc6fc022e270d89e62000744e4a6d41d0465 (patch) | |
tree | 6ffc160cb0fa50b05725298e9abb6a4dccb1b357 /usr.sbin/inetd | |
parent | 6b05b97b0d77ee540a379df0093ff3cc66424a73 (diff) | |
download | FreeBSD-src-cd7ecc6fc022e270d89e62000744e4a6d41d0465.zip FreeBSD-src-cd7ecc6fc022e270d89e62000744e4a6d41d0465.tar.gz |
Fix for the hosts_options(5) spawn option.
Restore default SIGHUP, SIGCHLD and SIGALRM handlers in forked inetd
processes. This happens to work around the fact that hosts_access()
doesn't (but should) set SIG_IGN as the handler for SIGCHLD while it
handles the spawn option, but it would make sense even if that were
not true.
This does not address the leaking descriptors issue discussed on the
same PR.
PR: 12731
Reviewed by: des
Submitted by: David Malone <dwmalone@maths.tcd.ie>
Diffstat (limited to 'usr.sbin/inetd')
-rw-r--r-- | usr.sbin/inetd/inetd.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c index 07ae88c..341c89b 100644 --- a/usr.sbin/inetd/inetd.c +++ b/usr.sbin/inetd/inetd.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)from: inetd.c 8.4 (Berkeley) 4/13/94"; #endif static const char rcsid[] = - "$Id: inetd.c,v 1.61 1999/07/15 17:01:43 green Exp $"; + "$Id: inetd.c,v 1.62 1999/07/21 12:19:24 sheldonh Exp $"; #endif /* not lint */ /* @@ -351,7 +351,7 @@ main(argc, argv, envp) struct servtab *sep; struct passwd *pwd; struct group *grp; - struct sigaction sa, sapipe; + struct sigaction sa, saalrm, sachld, sahup, sapipe; int tmpint, ch, dofork; pid_t pid; char buf[50]; @@ -457,12 +457,12 @@ main(argc, argv, envp) sigaddset(&sa.sa_mask, SIGCHLD); sigaddset(&sa.sa_mask, SIGHUP); sa.sa_handler = flag_retry; - sigaction(SIGALRM, &sa, (struct sigaction *)0); + sigaction(SIGALRM, &sa, &saalrm); config(); sa.sa_handler = flag_config; - sigaction(SIGHUP, &sa, (struct sigaction *)0); + sigaction(SIGHUP, &sa, &sahup); sa.sa_handler = flag_reapchild; - sigaction(SIGCHLD, &sa, (struct sigaction *)0); + sigaction(SIGCHLD, &sa, &sachld); sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, &sapipe); @@ -624,6 +624,10 @@ main(argc, argv, envp) for (tmpint = maxsock; tmpint > 2; tmpint--) if (tmpint != ctrl) (void) close(tmpint); + sigaction(SIGALRM, &saalrm, (struct sigaction *)0); + sigaction(SIGCHLD, &sachld, (struct sigaction *)0); + sigaction(SIGHUP, &sahup, (struct sigaction *)0); + /* SIGPIPE reset before exec */ } /* * Call tcpmux to find the real service to exec. |