From: Kurt Zeilenga Date: Sat, 17 Apr 1999 05:21:30 +0000 (+0000) Subject: Protect listener_tid from being killed after the listener has exited. X-Git-Tag: OPENLDAP_SLAPD_BACK_LDAP~164 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3041aafc2cbc6ff252a5ef2d79b606a0c5d39754;p=openldap Protect listener_tid from being killed after the listener has exited. --- diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index 63c5923a91..1f20c881a4 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -25,6 +25,7 @@ int dtblsize; static ldap_pvt_thread_t listener_tid; static volatile sig_atomic_t slapd_shutdown = 0; +static volatile sig_atomic_t slapd_listener = 0; struct slap_daemon { ldap_pvt_thread_mutex_t sd_mutex; @@ -229,6 +230,8 @@ slapd_daemon_task( int tcps = ((int *)ptr) [1]; free( ptr ); + slapd_listener=1; + connections_init(); ldap_pvt_thread_mutex_init( &slap_daemon.sd_mutex ); @@ -588,6 +591,7 @@ slapd_daemon_task( } ldap_pvt_thread_mutex_unlock( &active_threads_mutex ); + slapd_listener = 0; return NULL; } @@ -625,7 +629,10 @@ void slap_set_shutdown( int sig ) { slapd_shutdown = sig; - ldap_pvt_thread_kill( listener_tid, LDAP_SIGUSR1 ); + + if(slapd_listener) { + ldap_pvt_thread_kill( listener_tid, LDAP_SIGUSR1 ); + } /* reinstall self */ (void) SIGNAL( sig, slap_set_shutdown );