diff options
author | Ralph Boehme <slow@samba.org> | 2017-09-29 13:07:53 +0200 |
---|---|---|
committer | Ralph Boehme <slow@samba.org> | 2017-09-30 12:14:56 +0200 |
commit | 6539cc8a24204697b20506896c401e7b40eee928 (patch) | |
tree | b1d68e7280a165fe4d8ab6d2c8dc6b63b0eb883e /lib | |
parent | 94a8331e5425b735f9e2c0121afc2fb108bec891 (diff) | |
download | samba-6539cc8a24204697b20506896c401e7b40eee928.tar.gz |
lib/util/run_cmd: use a cleanup function instead of a destructor
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>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Sat Sep 30 12:14:57 CEST 2017 on sn-devel-144
Diffstat (limited to 'lib')
-rw-r--r-- | lib/util/util_runcmd.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/util/util_runcmd.c b/lib/util/util_runcmd.c index b2f0d9fbc45..42d84a895bf 100644 --- a/lib/util/util_runcmd.c +++ b/lib/util/util_runcmd.c @@ -32,8 +32,12 @@ #include "../lib/util/tfork.h" #include "../lib/util/sys_rw.h" -static int samba_runcmd_state_destructor(struct samba_runcmd_state *state) +static void samba_runcmd_cleanup_fn(struct tevent_req *req, + enum tevent_req_state req_state) { + struct samba_runcmd_state *state = tevent_req_data( + req, struct samba_runcmd_state); + if (state->tfork != NULL) { tfork_destroy(&state->tfork); } @@ -43,7 +47,6 @@ static int samba_runcmd_state_destructor(struct samba_runcmd_state *state) close(state->fd_stdin); state->fd_stdin = -1; } - return 0; } static void samba_runcmd_io_handler(struct tevent_context *ev, @@ -140,7 +143,7 @@ struct tevent_req *samba_runcmd_send(TALLOC_CTX *mem_ctx, smb_set_close_on_exec(state->fd_stderr); smb_set_close_on_exec(state->fd_status); - talloc_set_destructor(state, samba_runcmd_state_destructor); + tevent_req_set_cleanup_fn(req, samba_runcmd_cleanup_fn); state->fde_stdout = tevent_add_fd(ev, state, state->fd_stdout, |