summaryrefslogtreecommitdiff
path: root/usr.sbin/faithd/faithd.c
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2001-03-20 01:13:55 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2001-03-20 01:13:55 +0000
commitbc2153cab8b581fcba77f4990a4eee0731dd3be5 (patch)
treed496a3215090f4764908ff82dce364ac7102801c /usr.sbin/faithd/faithd.c
parent40407d969a2aeb203642512692615eb4e23e63a4 (diff)
avoid zombies on abnormal disconnections. sync with kame
Diffstat (limited to 'usr.sbin/faithd/faithd.c')
-rw-r--r--usr.sbin/faithd/faithd.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/usr.sbin/faithd/faithd.c b/usr.sbin/faithd/faithd.c
index 223bc3ef408..8bb6b8d5d85 100644
--- a/usr.sbin/faithd/faithd.c
+++ b/usr.sbin/faithd/faithd.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: faithd.c,v 1.10 2001/02/15 17:37:33 itojun Exp $ */
-/* $KAME: faithd.c,v 1.35 2001/02/10 05:24:52 itojun Exp $ */
+/* $OpenBSD: faithd.c,v 1.11 2001/03/20 01:13:54 itojun Exp $ */
+/* $KAME: faithd.c,v 1.38 2001/02/27 06:46:52 itojun Exp $ */
/*
* Copyright (C) 1997 and 1998 WIDE Project.
@@ -784,13 +784,25 @@ sig_terminate(int sig)
static void
start_daemon(void)
{
+#ifdef SA_NOCLDWAIT
+ struct sigaction sa;
+#endif
+
if (daemon(0, 0) == -1)
exit_stderr("daemon: %s", ERRSTR);
+#ifdef SA_NOCLDWAIT
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_handler = sig_child;
+ sa.sa_flags = SA_NOCLDWAIT;
+ sigemptyset(&sa.sa_mask);
+ sigaction(SIGCHLD, &sa, (struct sigaction *)0);
+#else
if (signal(SIGCHLD, sig_child) == SIG_ERR) {
exit_failure("signal CHLD: %s", ERRSTR);
/*NOTREACHED*/
}
+#endif
if (signal(SIGTERM, sig_terminate) == SIG_ERR) {
exit_failure("signal TERM: %s", ERRSTR);