summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2015-05-28 13:31:17 +0200
committerStefan Metzmacher <metze@samba.org>2015-06-12 17:08:17 +0200
commit9d3444ad887bb3a118eaecd141c79dfd6de53f41 (patch)
tree34db991a3a6455fd82ae89b66254b00d1f0f82ba /source3
parent0c108f55d9c3cca0bde1c15c66dccabbc40e6133 (diff)
downloadsamba-9d3444ad887bb3a118eaecd141c79dfd6de53f41.tar.gz
s3:lib/background: make sure we destroy a pending read_packet_send() before closing the pipe fd
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/background.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/source3/lib/background.c b/source3/lib/background.c
index 869f2ef4750..4ea128211e7 100644
--- a/source3/lib/background.c
+++ b/source3/lib/background.c
@@ -34,6 +34,7 @@ struct background_job_state {
struct tevent_req *wakeup_req;
int pipe_fd;
+ struct tevent_req *pipe_req;
};
static int background_job_state_destructor(struct background_job_state *s);
@@ -103,14 +104,18 @@ struct tevent_req *background_job_send(TALLOC_CTX *mem_ctx,
static int background_job_state_destructor(struct background_job_state *state)
{
size_t i;
+
+ TALLOC_FREE(state->pipe_req);
if (state->pipe_fd != -1) {
close(state->pipe_fd);
state->pipe_fd = -1;
}
+
for (i=0; i<state->num_trigger_msgs; i++) {
messaging_deregister(state->msg, state->trigger_msgs[i],
state);
}
+
return 0;
}
@@ -207,6 +212,7 @@ static void background_job_waited(struct tevent_req *subreq)
return;
}
tevent_req_set_callback(subreq, background_job_done, req);
+ state->pipe_req = subreq;
}
static void background_job_done(struct tevent_req *subreq)
@@ -220,6 +226,8 @@ static void background_job_done(struct tevent_req *subreq)
int err;
int wait_secs;
+ state->pipe_req = NULL;
+
ret = read_packet_recv(subreq, talloc_tos(), &buf, &err);
TALLOC_FREE(subreq);
if (ret == -1) {