From: Hallvard Furuseth Date: Thu, 26 Mar 2009 22:11:06 +0000 (+0000) Subject: ITS#6037: save/restore errno in signal handlers X-Git-Tag: ACLCHECK_0~655 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1e470657b248003ee58a8dbed8379ddd9d3520af;p=openldap ITS#6037: save/restore errno in signal handlers --- 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; }