diff options
author | Volker Lendecke <vl@samba.org> | 2013-01-31 16:28:08 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2013-02-02 19:52:40 -0800 |
commit | 3ce58cbcf3d9653ee6b0002f52a29ab922beab4e (patch) | |
tree | ee65a7deb9790b162cbd9ea956c188445cceb46e | |
parent | e3309852f717e716181df584716aa17945326565 (diff) | |
download | samba-3ce58cbcf3d9653ee6b0002f52a29ab922beab4e.tar.gz samba-3ce58cbcf3d9653ee6b0002f52a29ab922beab4e.tar.bz2 samba-3ce58cbcf3d9653ee6b0002f52a29ab922beab4e.zip |
tevent_poll: Use the poll_event_context_destructor always
This is in preparation for the next patch to NULL out the event_ctx
pointers in the poll_ev->fresh list
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r-- | lib/tevent/tevent_poll.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/tevent/tevent_poll.c b/lib/tevent/tevent_poll.c index b6265fd3d0..f64dd386f9 100644 --- a/lib/tevent/tevent_poll.c +++ b/lib/tevent/tevent_poll.c @@ -55,12 +55,18 @@ struct poll_event_context { int exit_code; }; -static int poll_event_mt_destructor(struct poll_event_context *poll_ev) +static int poll_event_context_destructor(struct poll_event_context *poll_ev) { - if (poll_ev->signal_fd != -1) { - close(poll_ev->signal_fd); - poll_ev->signal_fd = -1; + if (poll_ev->signal_fd == -1) { + /* + * Non-threaded, no signal pipe + */ + return 0; } + + close(poll_ev->signal_fd); + poll_ev->signal_fd = -1; + if (poll_ev->num_fds == 0) { return 0; } @@ -85,6 +91,7 @@ static int poll_event_context_init(struct tevent_context *ev) poll_ev->ev = ev; poll_ev->signal_fd = -1; ev->additional_data = poll_ev; + talloc_set_destructor(poll_ev, poll_event_context_destructor); return 0; } @@ -140,7 +147,7 @@ static int poll_event_context_init_mt(struct tevent_context *ev) poll_ev->num_fds = 1; - talloc_set_destructor(poll_ev, poll_event_mt_destructor); + talloc_set_destructor(poll_ev, poll_event_context_destructor); return 0; } |