From db6b6bdbb1d8ce8f6c29d0b6bd8e43f67f0578b2 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sun, 2 Dec 2001 02:34:41 +0000 Subject: fix simple signal handlers --- kerberosIV/src/appl/kip/common.c | 2 ++ kerberosIV/src/appl/kx/kx.c | 6 ++++-- kerberosIV/src/appl/kx/kxd.c | 6 ++++-- 3 files changed, 10 insertions(+), 4 deletions(-) (limited to 'kerberosIV') diff --git a/kerberosIV/src/appl/kip/common.c b/kerberosIV/src/appl/kip/common.c index 4059a982c32..f01abd70f45 100644 --- a/kerberosIV/src/appl/kip/common.c +++ b/kerberosIV/src/appl/kip/common.c @@ -162,6 +162,7 @@ copy_packets (int tundev, int netdev, int mtu, des_cblock *iv, RETSIGTYPE childhandler (int sig) { + int save_errno = errno; pid_t pid; int status; @@ -169,6 +170,7 @@ childhandler (int sig) pid = waitpid (-1, &status, WNOHANG|WUNTRACED); } while(pid > 0); signal (SIGCHLD, childhandler); + errno = save_errno; SIGRETURN(0); } diff --git a/kerberosIV/src/appl/kx/kx.c b/kerberosIV/src/appl/kx/kx.c index 3bcd54344a7..d89d617ccd1 100644 --- a/kerberosIV/src/appl/kx/kx.c +++ b/kerberosIV/src/appl/kx/kx.c @@ -45,6 +45,7 @@ static int donep; static RETSIGTYPE childhandler (int sig) { + int save_errno = errno; pid_t pid; int status; @@ -52,9 +53,10 @@ childhandler (int sig) pid = waitpid (-1, &status, WNOHANG|WUNTRACED); if (pid > 0 && (WIFEXITED(status) || WIFSIGNALED(status))) if (--nchild == 0 && donep) - exit (0); + _exit (0); } while(pid > 0); signal (SIGCHLD, childhandler); + errno = save_errno; SIGRETURN(0); } @@ -82,7 +84,7 @@ usr2handler (int sig) { donep = 1; if (nchild == 0) - exit (0); + _exit (0); SIGRETURN(0); } diff --git a/kerberosIV/src/appl/kx/kxd.c b/kerberosIV/src/appl/kx/kxd.c index c54d1fab8fc..924d4d305a8 100644 --- a/kerberosIV/src/appl/kx/kxd.c +++ b/kerberosIV/src/appl/kx/kxd.c @@ -33,7 +33,7 @@ #include "kx.h" -RCSID("$KTH: kxd.c,v 1.61 1999/12/02 16:58:32 joda Exp $"); +RCSID("$KTH: kxd.c,v 1.61.2.1 2000/06/28 19:08:00 assar Exp $"); static pid_t wait_on_pid = -1; static int done = 0; @@ -45,6 +45,7 @@ static int done = 0; static RETSIGTYPE childhandler (int sig) { + int save_errno = errno; pid_t pid; int status; @@ -54,6 +55,7 @@ childhandler (int sig) done = 1; } while(pid > 0); signal (SIGCHLD, childhandler); + errno = save_errno; SIGRETURN(0); } @@ -73,7 +75,7 @@ fatal (kx_context *kc, int fd, char *format, ...) p = msg; *p++ = ERROR; vsnprintf ((char *)p + 4, sizeof(msg) - 5, format, args); - syslog (LOG_ERR, (char *)p + 4); + syslog (LOG_ERR, "%s", (char *)p + 4); len = strlen ((char *)p + 4); p += KRB_PUT_INT (len, p, 4, 4); p += len; -- cgit v1.2.3