summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Pfatschbacher <mpf@cvs.openbsd.org>2005-07-28 16:59:43 +0000
committerMarco Pfatschbacher <mpf@cvs.openbsd.org>2005-07-28 16:59:43 +0000
commit6100a2dd8a8f28dad29d1ca6e17ddbf78ce9734e (patch)
treef967fc99b6f9c57e0c2aa259a7107a7224c54a85
parent51b258c419b1cb150fb9ce3cc78d77b05f721258 (diff)
Fix two situations where ifstated was leaking zombies.
Tested by sturm@ OK henning@
-rw-r--r--usr.sbin/ifstated/ifstated.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.sbin/ifstated/ifstated.c b/usr.sbin/ifstated/ifstated.c
index 4e9c1822c21..2d65bc8d7ad 100644
--- a/usr.sbin/ifstated/ifstated.c
+++ b/usr.sbin/ifstated/ifstated.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifstated.c,v 1.21 2005/02/07 12:38:44 mcbride Exp $ */
+/* $OpenBSD: ifstated.c,v 1.22 2005/07/28 16:59:42 mpf Exp $ */
/*
* Copyright (c) 2004 Marco Pfatschbacher <mpf@openbsd.org>
@@ -265,12 +265,14 @@ external_async_exec(struct ifsd_external *external)
{
char *argp[] = {"sh", "-c", NULL, NULL};
pid_t pid;
+ int s;
if (external->pid > 0) {
logit(IFSD_LOG_NORMAL,
"previous command %s [%d] still running, killing it",
external->command, external->pid);
kill(external->pid, SIGKILL);
+ waitpid(external->pid, &s, 0);
external->pid = 0;
}
@@ -354,6 +356,7 @@ void
external_evtimer_setup(struct ifsd_state *state, int action)
{
struct ifsd_external *external;
+ int s;
if (state != NULL) {
switch (action) {
@@ -378,6 +381,7 @@ external_evtimer_setup(struct ifsd_state *state, int action)
&state->external_tests, entries) {
if (external->pid > 0) {
kill(external->pid, SIGKILL);
+ waitpid(external->pid, &s, 0);
external->pid = 0;
}
evtimer_del(&external->ev);