]> git.neil.brown.name Git - portmap.git/commitdiff
Signal handling fixes.
authorNeil Brown <neilb@notabene.brown>
Fri, 20 Apr 2007 02:42:08 +0000 (12:42 +1000)
committerNeil Brown <neilb@notabene.brown>
Fri, 20 Apr 2007 02:42:08 +0000 (12:42 +1000)
Ignore sigchld and sigpipe.
And as reap is now not used, don't compile it.

Makefile
portmap.c

index 5d8634857560a3d30b540b93fee092d5ec975728..7f5178797315f9da3a0e1d3912f3c118be610d1b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -71,7 +71,7 @@ CHECK_PORT = -DCHECK_PORT
 # With verbose logging on, HP-UX 9.x and AIX 4.1 leave zombies behind when
 # SIGCHLD is not ignored. Enable next macro for a fix.
 #
-# ZOMBIES = -DIGNORE_SIGCHLD   # AIX 4.x, HP-UX 9.x
+ZOMBIES = -DIGNORE_SIGCHLD     # AIX 4.x, HP-UX 9.x
 
 # Uncomment the following macro if your system does not have u_long.
 #
index 343477b7bd9c91c10c0e4dd7f116a15f86158b0d..f50e85b7e441c21e99c9f21b7a255575eed99dac 100644 (file)
--- a/portmap.c
+++ b/portmap.c
@@ -123,7 +123,9 @@ static char sccsid[] = "@(#)portmap.c 1.32 87/08/06 Copyr 1984 Sun Micro";
 #endif
 
 static void reg_service(struct svc_req *rqstp, SVCXPRT *xprt);
+#ifndef IGNORE_SIGCHLD                 /* Lionel Cons <cons@dxcern.cern.ch> */
 static void reap(int);
+#endif
 static void callit(struct svc_req *rqstp, SVCXPRT *xprt);
 struct pmaplist *pmaplist;
 int debugging = 0;
@@ -287,6 +289,7 @@ main(int argc, char **argv)
 #else
        (void)signal(SIGCHLD, reap);
 #endif
+       (void)signal(SIGPIPE, SIG_IGN);
        svc_run();
        syslog(LOG_ERR, "run_svc returned unexpectedly");
        abort();
@@ -671,9 +674,11 @@ static void callit(struct svc_req *rqstp, SVCXPRT *xprt)
        exit(0);
 }
 
+#ifndef IGNORE_SIGCHLD                 /* Lionel Cons <cons@dxcern.cern.ch> */
 static void reap(int ignore)
 {
        int save_errno = errno;
        while (wait3((int *)NULL, WNOHANG, (struct rusage *)NULL) > 0);
        errno = save_errno;
 }
+#endif