Update to the 'gentle SIGHUP' patch. (ITS#1679) - Let write operations return unwilling-to-perform after 'gentle shutdown' has been initiated. - Change -1 to 2 in slapd_gentle_shutdown and slapd_shutdown, since sig_atomic_t can be unsigned (ITS#1736). The 'gentle SIGHUP' patch is older than ITS#1736 but was applied later, so it reintroduced the problem. Hallvard B. Furuseth , June 2002. diff -r -u2 doc/man/man5/slapd.conf.5~ doc/man/man5/slapd.conf.5 --- doc/man/man5/slapd.conf.5~ Wed Jun 5 11:40:12 2002 +++ doc/man/man5/slapd.conf.5 Mon Jun 10 18:31:43 2002 @@ -209,5 +209,6 @@ .B Slapd will stop listening for new connections, but will not close the -connections to the current clients. It terminates when all clients +connections to the current clients. Future write operations return +unwilling-to-perform, though. Slapd terminates when all clients have closed their connections (if they ever do), or \- as before \- if it receives a SIGTERM signal. This can be useful if you wish to diff -r -u2 servers/slapd/daemon.c~ servers/slapd/daemon.c --- servers/slapd/daemon.c~ Thu Jun 6 13:43:30 2002 +++ servers/slapd/daemon.c Mon Jun 10 04:59:17 2002 @@ -238,5 +238,5 @@ ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex ); - WAKE_LISTENER(wake || slapd_gentle_shutdown < 0); + WAKE_LISTENER(wake || slapd_gentle_shutdown == 2); } @@ -1115,8 +1115,9 @@ ber_socket_t active; - if( slapd_gentle_shutdown > 0 ) { + if( slapd_gentle_shutdown == 1 ) { Debug( LDAP_DEBUG_ANY, "slapd gentle shutdown\n", 0, 0, 0 ); close_listeners( 1 ); - slapd_gentle_shutdown = -1; + global_restrictops |= SLAP_RESTRICT_OP_WRITES; + slapd_gentle_shutdown = 2; } @@ -1125,5 +1126,5 @@ ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex ); if( active == 0 ) { - slapd_shutdown = -1; + slapd_shutdown = 2; break; } @@ -1781,5 +1782,5 @@ } - if( slapd_gentle_shutdown >= 0 ) + if( slapd_gentle_shutdown != 2 ) close_listeners ( 0 ); free ( slap_listeners );