]> granicus.if.org Git - libevent/commitdiff
debug cleanups in signal.c; from Christopher Layne
authorNiels Provos <provos@gmail.com>
Tue, 13 Nov 2007 17:36:58 +0000 (17:36 +0000)
committerNiels Provos <provos@gmail.com>
Tue, 13 Nov 2007 17:36:58 +0000 (17:36 +0000)
svn:r527

ChangeLog
signal.c

index ccdfc8ba1d5537f81c439837951a7f4ca044456e..576345b7717e4e6126a0731453d6c3eb355db255 100644 (file)
--- 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.
index 22acd3867b5c79539a3a217e8c5afdb08aa8605f..4b3a488ee45812f7d2461e3e72b7e97907cb2448 100644 (file)
--- 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