]> git.sur5r.net Git - openldap/commitdiff
ITS#6322 cleanup close_listeners()
authorHoward Chu <hyc@openldap.org>
Wed, 30 Dec 2009 20:33:27 +0000 (20:33 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 30 Dec 2009 20:33:27 +0000 (20:33 +0000)
servers/slapd/daemon.c

index 1acc659712ffeab3cd14bbd5087bc785cadfb0a7..1d000c14f7962fe7a8bc670fab8525c448eae203 100644 (file)
@@ -1720,9 +1720,12 @@ close_listeners(
 
        for ( l = 0; slap_listeners[l] != NULL; l++ ) {
                Listener *lr = slap_listeners[l];
+               slap_listeners[l] = NULL;
 
                if ( lr->sl_sd != AC_SOCKET_INVALID ) {
-                       if ( remove ) slapd_remove( lr->sl_sd, NULL, 0, 0, 0 );
+                       int s = lr->sl_sd;
+                       lr->sl_sd = AC_SOCKET_INVALID;
+                       if ( remove ) slapd_remove( s, NULL, 0, 0, 0 );
 
 #ifdef LDAP_PF_LOCAL
                        if ( lr->sl_sa.sa_addr.sa_family == AF_LOCAL ) {
@@ -1730,7 +1733,7 @@ close_listeners(
                        }
 #endif /* LDAP_PF_LOCAL */
 
-                       slapd_close( lr->sl_sd );
+                       slapd_close( s );
                }
 
                if ( lr->sl_url.bv_val ) {
@@ -1742,7 +1745,6 @@ close_listeners(
                }
 
                free( lr );
-               slap_listeners[l] = NULL;
        }
 }