diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2008-03-16 16:55:30 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2008-03-16 16:55:30 +0000 |
commit | 68d85f5a89fb982d3c281c6c189cd217dc0d9ae0 (patch) | |
tree | 9a91d768d7d32d607f03cb206c9fbaceeb5d185e | |
parent | da8d2509bf8f9d317e04899b26333b4229912d09 (diff) |
avoid errno trashing, ok mpf henning
-rw-r--r-- | usr.sbin/syslogd/privsep.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.sbin/syslogd/privsep.c b/usr.sbin/syslogd/privsep.c index 13b74e14d5a..d77ea353108 100644 --- a/usr.sbin/syslogd/privsep.c +++ b/usr.sbin/syslogd/privsep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: privsep.c,v 1.31 2008/03/16 15:44:18 mpf Exp $ */ +/* $OpenBSD: privsep.c,v 1.32 2008/03/16 16:55:29 deraadt Exp $ */ /* * Copyright (c) 2003 Anil Madhavapeddy <anil@recoil.org> @@ -737,11 +737,11 @@ priv_gethostbyaddr(char *addr, int addr_len, int af, char *res, size_t res_len) static void sig_pass_to_chld(int sig) { - int oerrno = errno; + int save_errno = errno; if (child_pid != -1) kill(child_pid, sig); - errno = oerrno; + errno = save_errno; } /* When child dies, move into the shutdown state */ @@ -749,6 +749,7 @@ sig_pass_to_chld(int sig) static void sig_got_chld(int sig) { + int save_errno = errno; pid_t pid; do { @@ -756,6 +757,7 @@ sig_got_chld(int sig) if (pid == child_pid && cur_state < STATE_QUIT) cur_state = STATE_QUIT; } while (pid > 0 || (pid == -1 && errno == EINTR)); + errno = save_errno; } /* Read all data or return 1 for error. */ |