From: Stefan Metzmacher Date: Tue, 22 Jul 2014 10:02:45 +0000 (+0200) Subject: tevent: simplify tevent_cleanup_pending_signal_handlers() X-Git-Tag: tevent-0.9.37~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a947939e11cacde7c4b4dce03bf12348642ee7f;p=thirdparty%2Fsamba.git tevent: simplify tevent_cleanup_pending_signal_handlers() Calling tevent_signal_destructor() does the same as se->event_ctx is already NULL. This also makes sure we correctly cleanup the SA_SIGINFO array. Signed-off-by: Stefan Metzmacher Reviewed-by: Ralph Boehme --- diff --git a/lib/tevent/tevent_signal.c b/lib/tevent/tevent_signal.c index 1283aab4821..6bb69d77d7a 100644 --- a/lib/tevent/tevent_signal.c +++ b/lib/tevent/tevent_signal.c @@ -194,6 +194,7 @@ static int tevent_signal_destructor(struct tevent_signal *se) DLIST_REMOVE(ev->signal_events, se); } + se->additional_data = NULL; talloc_free(sl); if (sig_state->sig_handlers[se->signum] == NULL) { @@ -464,18 +465,7 @@ int tevent_common_check_signal(struct tevent_context *ev) void tevent_cleanup_pending_signal_handlers(struct tevent_signal *se) { - struct tevent_common_signal_list *sl = - talloc_get_type_abort(se->additional_data, - struct tevent_common_signal_list); - - tevent_common_signal_list_destructor(sl); - - if (sig_state->sig_handlers[se->signum] == NULL) { - if (sig_state->oldact[se->signum]) { - sigaction(se->signum, sig_state->oldact[se->signum], NULL); - talloc_free(sig_state->oldact[se->signum]); - sig_state->oldact[se->signum] = NULL; - } - } + tevent_signal_destructor(se); + talloc_set_destructor(se, NULL); return; }