Ensure the state desctructor calls tfork_destroy to reap the waiter and
worker processes. Otherwise we leave the waiter process as a zombie
behind us as we never call waitpid on it in case of a timeout
or talloc_free() from the caller.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13062
Pair-programmed-with: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
static int samba_runcmd_state_destructor(struct samba_runcmd_state *state)
{
- if (state->pid > 0) {
- kill(state->pid, SIGKILL);
- waitpid(state->pid, NULL, 0);
- state->pid = -1;
+ if (state->tfork != NULL) {
+ tfork_destroy(&state->tfork);
}
+ state->pid = -1;
if (state->fd_stdin != -1) {
close(state->fd_stdin);
tevent_req_error(req, errno);
return;
}
+ state->pid = -1;
TALLOC_FREE(fde);
if (WIFEXITED(status)) {