Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/faithd avoid zombies on abnormal disconnects. sync...



details:   https://anonhg.NetBSD.org/src/rev/9a075acc4f04
branches:  trunk
changeset: 507328:9a075acc4f04
user:      itojun <itojun%NetBSD.org@localhost>
date:      Tue Mar 20 01:13:46 2001 +0000

description:
avoid zombies on abnormal disconnects.  sync with kame

diffstat:

 usr.sbin/faithd/faithd.c |  16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r 276b041bd893 -r 9a075acc4f04 usr.sbin/faithd/faithd.c
--- a/usr.sbin/faithd/faithd.c  Tue Mar 20 00:41:19 2001 +0000
+++ b/usr.sbin/faithd/faithd.c  Tue Mar 20 01:13:46 2001 +0000
@@ -1,5 +1,5 @@
-/*     $NetBSD: faithd.c,v 1.17 2001/02/15 17:58:55 itojun Exp $       */
-/*     $KAME: faithd.c,v 1.35 2001/02/10 05:24:52 itojun Exp $ */
+/*     $NetBSD: faithd.c,v 1.18 2001/03/20 01:13:46 itojun Exp $       */
+/*     $KAME: faithd.c,v 1.38 2001/02/27 06:46:52 itojun Exp $ */
 
 /*
  * Copyright (C) 1997 and 1998 WIDE Project.
@@ -776,13 +776,25 @@
 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);



Home | Main Index | Thread Index | Old Index