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>
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) {
strerror(errno)));
} else {
DEBUG(DEBUG_ERR,("Logged timedout eventscript : %s\n", buf));
+ /* Don't kill child until timeout done. */
+ state->child = 0;
}
}
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);
}