From ce9fd1914d142c6a9e6052aa36bd6a231c9662ad Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Fri, 20 Apr 2007 12:42:08 +1000 Subject: [PATCH] Signal handling fixes. Ignore sigchld and sigpipe. And as reap is now not used, don't compile it. --- Makefile | 2 +- portmap.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5d86348..7f51787 100644 --- 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. # diff --git a/portmap.c b/portmap.c index 343477b..f50e85b 100644 --- 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 */ 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 */ static void reap(int ignore) { int save_errno = errno; while (wait3((int *)NULL, WNOHANG, (struct rusage *)NULL) > 0); errno = save_errno; } +#endif -- 2.39.5