From: Niels Provos Date: Tue, 13 Nov 2007 17:36:58 +0000 (+0000) Subject: debug cleanups in signal.c; from Christopher Layne X-Git-Tag: release-2.0.1-alpha~500 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=56934d5d977892afa1342c8c3f55035989626bc5;p=libevent debug cleanups in signal.c; from Christopher Layne svn:r527 --- diff --git a/ChangeLog b/ChangeLog index ccdfc8ba..576345b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ Changes in current version: o free minheap on event_base_free(); from Christopher Layne + o debug cleanups in signal.c; from Christopher Layne Changes in 1.4.0: o allow \r or \n individually to separate HTTP headers instead of the standard "\r\n"; from Charles Kerr. diff --git a/signal.c b/signal.c index 22acd386..4b3a488e 100644 --- a/signal.c +++ b/signal.c @@ -141,7 +141,7 @@ evsignal_add(struct event *ev) * a dynamic array is used to keep footprint on the low side. */ if (evsignal >= sig->sh_old_max) { - event_debug(("%s: evsignal > sh_old_max, resizing array", + event_debug(("%s: evsignal (%d) >= sh_old_max (%d), resizing", __func__, evsignal, sig->sh_old_max)); sig->sh_old_max = evsignal + 1; p = realloc(sig->sh_old, sig->sh_old_max * sizeof *sig->sh_old); @@ -159,21 +159,20 @@ evsignal_add(struct event *ev) return (-1); } + /* save previous handler and setup new handler */ + event_debug(("%s: %p: changing signal handler", __func__, ev)); #ifdef HAVE_SIGACTION - /* setup new handler */ memset(&sa, 0, sizeof(sa)); sa.sa_handler = evsignal_handler; sa.sa_flags |= SA_RESTART; sigfillset(&sa.sa_mask); - /* save previous handler setup */ if (sigaction(evsignal, &sa, sig->sh_old[evsignal]) == -1) { event_warn("sigaction"); free(sig->sh_old[evsignal]); return (-1); } #else - /* save previous handler setup */ if ((sh = signal(evsignal, evsignal_handler)) == SIG_ERR) { event_warn("signal"); free(sig->sh_old[evsignal]); @@ -207,6 +206,7 @@ evsignal_del(struct event *ev) evsignal = EVENT_SIGNAL(ev); /* restore previous handler */ + event_debug(("%s: %p: restoring signal handler", __func__, ev)); sh = sig->sh_old[evsignal]; sig->sh_old[evsignal] = NULL; #ifdef HAVE_SIGACTION