summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2007-10-13 17:50:06 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2007-10-13 17:50:06 +0000
commitcbe31b028bc682e77c95d3ee35143e67f3d0be47 (patch)
tree79fd0ec7db18aee3ff38c7128a169e1aee31021b
parent03aa0da667eb224b857f57c160d3591493908b2b (diff)
avoid errno trashing in signal handler
-rw-r--r--usr.sbin/hoststated/check_script.c5
-rw-r--r--usr.sbin/relayd/check_script.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/usr.sbin/hoststated/check_script.c b/usr.sbin/hoststated/check_script.c
index 19b9b0da49a..3d050d95058 100644
--- a/usr.sbin/hoststated/check_script.c
+++ b/usr.sbin/hoststated/check_script.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: check_script.c,v 1.2 2007/06/12 15:16:10 msf Exp $ */
+/* $OpenBSD: check_script.c,v 1.3 2007/10/13 17:50:05 deraadt Exp $ */
/*
* Copyright (c) 2007 Reyk Floeter <reyk@openbsd.org>
@@ -79,8 +79,11 @@ script_done(struct hoststated *env, struct ctl_script *scr)
void
script_sig_alarm(int sig)
{
+ int save_errno = errno;
+
if (child != -1)
kill(child, SIGKILL);
+ errno = save_errno;
}
int
diff --git a/usr.sbin/relayd/check_script.c b/usr.sbin/relayd/check_script.c
index 19b9b0da49a..3d050d95058 100644
--- a/usr.sbin/relayd/check_script.c
+++ b/usr.sbin/relayd/check_script.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: check_script.c,v 1.2 2007/06/12 15:16:10 msf Exp $ */
+/* $OpenBSD: check_script.c,v 1.3 2007/10/13 17:50:05 deraadt Exp $ */
/*
* Copyright (c) 2007 Reyk Floeter <reyk@openbsd.org>
@@ -79,8 +79,11 @@ script_done(struct hoststated *env, struct ctl_script *scr)
void
script_sig_alarm(int sig)
{
+ int save_errno = errno;
+
if (child != -1)
kill(child, SIGKILL);
+ errno = save_errno;
}
int