tevent: make sure we don't set errno within the signal handler function.
authorStefan Metzmacher <metze@samba.org>
Mon, 21 Sep 2009 01:16:18 +0000 (03:16 +0200)
committerKarolin Seeger <kseeger@samba.org>
Thu, 8 Oct 2009 07:39:44 +0000 (09:39 +0200)
metze
(cherry picked from commit d13dfbeb6c6ab5b20277439da5b95f1a7f2850eb)

lib/tevent/tevent_signal.c

index ef9c0cf28877999b27d19323ae70018336a455c1..0ca2a2760b0338112a1f3ebaa9cceb1ec857cabc 100644 (file)
@@ -85,6 +85,7 @@ static void tevent_common_signal_handler(int signum)
        ssize_t res;
        struct tevent_common_signal_list *sl;
        struct tevent_context *ev = NULL;
+       int saved_errno = errno;
 
        SIG_INCREMENT(sig_state->signal_count[signum]);
        SIG_INCREMENT(sig_state->got_signal);
@@ -103,6 +104,8 @@ static void tevent_common_signal_handler(int signum)
                        ev = sl->se->event_ctx;
                }
        }
+
+       errno = saved_errno;
 }
 
 #ifdef SA_SIGINFO