summaryrefslogtreecommitdiff
path: root/lib/tevent
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tevent')
-rw-r--r--lib/tevent/tevent_signal.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/tevent/tevent_signal.c b/lib/tevent/tevent_signal.c
index 0fdf646c8d..8e13d7351f 100644
--- a/lib/tevent/tevent_signal.c
+++ b/lib/tevent/tevent_signal.c
@@ -175,7 +175,19 @@ static int tevent_signal_destructor(struct tevent_signal *se)
struct tevent_common_signal_list);
if (se->event_ctx) {
- DLIST_REMOVE(se->event_ctx->signal_events, se);
+ struct tevent_context *ev = se->event_ctx;
+
+ DLIST_REMOVE(ev->signal_events, se);
+
+ if (ev->signal_events == NULL && ev->pipe_fde != NULL) {
+ /*
+ * This was the last signal. Destroy the pipe.
+ */
+ TALLOC_FREE(ev->pipe_fde);
+
+ close(ev->pipe_fds[0]);
+ close(ev->pipe_fds[1]);
+ }
}
talloc_free(sl);