Source-Changes-HG archive

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

[src/trunk]: src/libexec/identd Remove the zombie reaper and set SIG_IGN on S...



details:   https://anonhg.NetBSD.org/src/rev/7b44f93a4752
branches:  trunk
changeset: 580971:7b44f93a4752
user:      peter <peter%NetBSD.org@localhost>
date:      Wed May 18 00:31:32 2005 +0000

description:
Remove the zombie reaper and set SIG_IGN on SIGCHLD. We won't get a zombie
when the child exists this way and it should also fix the race condition
as mentioned in PR bin/30253 from Patrick McPhee.

Approved by christos.

diffstat:

 libexec/identd/identd.c |  16 +++-------------
 1 files changed, 3 insertions(+), 13 deletions(-)

diffs (65 lines):

diff -r a04ad63e6dc2 -r 7b44f93a4752 libexec/identd/identd.c
--- a/libexec/identd/identd.c   Wed May 18 00:15:52 2005 +0000
+++ b/libexec/identd/identd.c   Wed May 18 00:31:32 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: identd.c,v 1.26 2005/04/03 22:15:32 peter Exp $ */
+/* $NetBSD: identd.c,v 1.27 2005/05/18 00:31:32 peter Exp $ */
 
 /*
  * identd.c - TCP/IP Ident protocol server.
@@ -12,7 +12,6 @@
 #include <sys/stat.h>
 #include <sys/param.h>
 #include <sys/sysctl.h>
-#include <sys/wait.h>
 
 #include <netinet/in.h>
 #include <netinet/ip_var.h>
@@ -40,7 +39,7 @@
 
 #include "identd.h"
 
-__RCSID("$NetBSD: identd.c,v 1.26 2005/04/03 22:15:32 peter Exp $");
+__RCSID("$NetBSD: identd.c,v 1.27 2005/05/18 00:31:32 peter Exp $");
 
 #define OPSYS_NAME     "UNIX"
 #define IDENT_SERVICE  "auth"
@@ -63,7 +62,6 @@
 static void  random_string(char *, size_t);
 static int   change_format(const char *, struct passwd *, char *, size_t);
 static void  timeout_handler(int);
-static void  waitchild(int);
 static void  fatal(const char *);
 static void  die(const char *, ...);
 
@@ -257,7 +255,6 @@
                int fd, nfds, rv;
                struct pollfd *rfds;
 
-               (void)signal(SIGCHLD, waitchild);
                if (daemon(0, 0) < 0)
                        die("daemon: %s", strerror(errno));
 
@@ -298,6 +295,7 @@
                                                    proxy_addr, timeout);
                                                _exit(EXIT_SUCCESS);
                                        default:        /* parent */
+                                               (void)signal(SIGCHLD, SIG_IGN);
                                                (void)close(fd);
                                        }
                                }
@@ -1005,14 +1003,6 @@
        exit(EXIT_FAILURE);
 }
 
-/* This is to clean up zombie processes when in daemon mode. */
-static void
-waitchild(int s)
-{
-       while (waitpid(-1, NULL, WNOHANG) > 0)
-               continue;
-}
-
 /* Report error message string through syslog and quit. */
 static void
 fatal(const char *func)



Home | Main Index | Thread Index | Old Index