summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRalph Boehme <slow@samba.org>2017-09-29 13:07:53 +0200
committerStefan Metzmacher <metze@samba.org>2017-10-02 13:17:15 +0200
commit6a678665aec5ec026edb49841f037703ea2fd5a7 (patch)
tree31b47336185e994b65c993d2b07de242f59c7ee8 /lib
parent31eefb6c98418cdde9dcee383262a298ae956ac4 (diff)
downloadsamba-6a678665aec5ec026edb49841f037703ea2fd5a7.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 (cherry picked from commit 6539cc8a24204697b20506896c401e7b40eee928) Autobuild-User(v4-7-test): Stefan Metzmacher <metze@samba.org> Autobuild-Date(v4-7-test): Mon Oct 2 13:17:15 CEST 2017 on sn-devel-144
Diffstat (limited to 'lib')
-rw-r--r--lib/util/util_runcmd.c9
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,