From 1e470657b248003ee58a8dbed8379ddd9d3520af Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Thu, 26 Mar 2009 22:11:06 +0000 Subject: [PATCH] ITS#6037: save/restore errno in signal handlers --- servers/slapd/daemon.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index f9606c928e..a7a0bb2179 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -2759,6 +2759,8 @@ sockdestroy( void ) RETSIGTYPE slap_sig_shutdown( int sig ) { + int save_errno = errno; + #if 0 Debug(LDAP_DEBUG_TRACE, "slap_sig_shutdown: signal %d\n", sig, 0, 0); #endif @@ -2787,15 +2789,21 @@ slap_sig_shutdown( int sig ) /* reinstall self */ (void) SIGNAL_REINSTALL( sig, slap_sig_shutdown ); + + errno = save_errno; } RETSIGTYPE slap_sig_wake( int sig ) { + int save_errno = errno; + WAKE_LISTENER(1); /* reinstall self */ (void) SIGNAL_REINSTALL( sig, slap_sig_wake ); + + errno = save_errno; } -- 2.39.5