summaryrefslogtreecommitdiff
path: root/kerberosV
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2001-12-02 02:34:41 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2001-12-02 02:34:41 +0000
commitdb6b6bdbb1d8ce8f6c29d0b6bd8e43f67f0578b2 (patch)
treed90018ecbd5267161f93dd8b1b77f8953ee38f55 /kerberosV
parenta7ada8b599a929a8a91a7ff4fc0508e79affed5f (diff)
fix simple signal handlers
Diffstat (limited to 'kerberosV')
-rw-r--r--kerberosV/src/appl/kx/kx.c10
-rw-r--r--kerberosV/src/appl/kx/kxd.c6
-rw-r--r--kerberosV/src/kadmin/kadm_conn.c6
3 files changed, 15 insertions, 7 deletions
diff --git a/kerberosV/src/appl/kx/kx.c b/kerberosV/src/appl/kx/kx.c
index 34a1f8c9bd4..b0d954b44d6 100644
--- a/kerberosV/src/appl/kx/kx.c
+++ b/kerberosV/src/appl/kx/kx.c
@@ -33,7 +33,7 @@
#include "kx.h"
-RCSID("$KTH: kx.c,v 1.67 2000/10/08 13:21:17 assar Exp $");
+RCSID("$KTH: kx.c,v 1.68 2001/02/20 01:44:45 assar Exp $");
static int nchild;
static int donep;
@@ -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);
}
@@ -690,7 +692,7 @@ main(int argc, char **argv)
int ret = 1;
char *host = NULL;
- set_progname (argv[0]);
+ setprogname (argv[0]);
if (getarg (args, sizeof(args) / sizeof(args[0]), argc, argv,
&optind))
diff --git a/kerberosV/src/appl/kx/kxd.c b/kerberosV/src/appl/kx/kxd.c
index cf089b7afc8..7d84e299199 100644
--- a/kerberosV/src/appl/kx/kxd.c
+++ b/kerberosV/src/appl/kx/kxd.c
@@ -33,7 +33,7 @@
#include "kx.h"
-RCSID("$KTH: kxd.c,v 1.68 2000/10/08 13:22:19 assar Exp $");
+RCSID("$KTH: kxd.c,v 1.69 2001/02/20 01:44:45 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);
}
@@ -708,7 +710,7 @@ main (int argc, char **argv)
int port;
int optind = 0;
- set_progname (argv[0]);
+ setprogname (argv[0]);
roken_openlog ("kxd", LOG_ODELAY | LOG_PID, LOG_DAEMON);
if (getarg (args, sizeof(args) / sizeof(args[0]), argc, argv,
diff --git a/kerberosV/src/kadmin/kadm_conn.c b/kerberosV/src/kadmin/kadm_conn.c
index 9b711375231..8b66ce45ce4 100644
--- a/kerberosV/src/kadmin/kadm_conn.c
+++ b/kerberosV/src/kadmin/kadm_conn.c
@@ -96,14 +96,17 @@ volatile sig_atomic_t term_flag, doing_useful_work;
static RETSIGTYPE
sigchld(int sig)
{
+ int save_errno = errno;
int status;
waitpid(-1, &status, 0);
+ errno = save_errno;
SIGRETURN(0);
}
static RETSIGTYPE
terminate(int sig)
{
+ int save_errno = errno;
if(getpid() == pgrp) {
/* parent */
term_flag = 1;
@@ -114,8 +117,9 @@ terminate(int sig)
if(doing_useful_work)
term_flag = 1;
else
- exit(0);
+ _exit(0);
}
+ errno = save_errno;
SIGRETURN(0);
}