diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2010-04-08 15:09:08 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2010-04-08 15:09:08 +0930 |
commit | a9c8b9e89b9bc1affc11db9c84b0a2bc079331d3 (patch) | |
tree | 700c50ce75231d9363b1a70dae32887198e2cc9a /ctdb/server/eventscript.c | |
parent | e1b59b6a478cc2088f7a41dc492665d50607a2db (diff) | |
download | samba-a9c8b9e89b9bc1affc11db9c84b0a2bc079331d3.tar.gz samba-a9c8b9e89b9bc1affc11db9c84b0a2bc079331d3.tar.xz samba-a9c8b9e89b9bc1affc11db9c84b0a2bc079331d3.zip |
eventscript: wait for debugging dump before killing timedout script
Fairly simple: prevent the destructor from killing the script, and do it
explicitly from the debugging child.
We can remove the extra "already dead" test, since this will be detected
in the destructor anyway.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(This used to be ctdb commit f8aa83788e3cc10ab7655a90d7b7b17ddbe48685)
Diffstat (limited to 'ctdb/server/eventscript.c')
-rw-r--r-- | ctdb/server/eventscript.c | 9 |
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); } |