summaryrefslogtreecommitdiffstats
path: root/ctdb
diff options
context:
space:
mode:
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/server/eventscript.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/ctdb/server/eventscript.c b/ctdb/server/eventscript.c
index 41da296031..2691d8f6ec 100644
--- a/ctdb/server/eventscript.c
+++ b/ctdb/server/eventscript.c
@@ -522,6 +522,8 @@ static void debug_timeout(struct ctdb_event_script_state *state)
if (pid == 0) {
ctdb_reduce_priority(state->ctdb);
system(buf);
+ /* Now we can kill the child */
+ kill(state->child, SIGTERM);
exit(0);
}
if (pid == -1) {
@@ -529,6 +531,8 @@ static void debug_timeout(struct ctdb_event_script_state *state)
strerror(errno)));
} else {
DEBUG(DEBUG_ERR,("Logged timedout eventscript : %s\n", buf));
+ /* Don't kill child until timeout done. */
+ state->child = 0;
}
}
@@ -560,11 +564,6 @@ static void ctdb_event_script_timeout(struct event_context *ev, struct timed_eve
debug_timeout(state);
}
- if (kill(state->child, 0) != 0) {
- DEBUG(DEBUG_ERR,("Event script child process already dead, errno %s(%d)\n", strerror(errno), errno));
- state->child = 0;
- }
-
talloc_free(state);
}