]> git.sur5r.net Git - openldap/commitdiff
don't close invalid sockets (blind fix to ITS#5606)
authorPierangelo Masarati <ando@openldap.org>
Sat, 12 Jul 2008 16:31:34 +0000 (16:31 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sat, 12 Jul 2008 16:31:34 +0000 (16:31 +0000)
servers/slapd/daemon.c

index 45bd7d3fe801afd8a33cad32a46c09c51e1793c4..92a2b03095c561c384c16296b6163538c0e69ce1 100644 (file)
@@ -79,7 +79,11 @@ Listener **slap_listeners = NULL;
 #define SLAPD_LISTEN_BACKLOG 1024
 #endif /* ! SLAPD_LISTEN_BACKLOG */
 
-static ber_socket_t wake_sds[2];
+static ber_socket_t wake_sds[2]
+#ifdef HAVE_WINSOCK
+       = { INVALID_SOCKET, INVALID_SOCKET }
+#endif /* HAVE_WINSOCK */
+       ;
 static int emfile;
 
 static volatile int waking;
@@ -1641,8 +1645,14 @@ int
 slapd_daemon_destroy( void )
 {
        connections_destroy();
-       tcp_close( SLAP_FD2SOCK(wake_sds[1]) );
-       tcp_close( SLAP_FD2SOCK(wake_sds[0]) );
+#ifdef HAVE_WINSOCK
+       if ( wake_sds[1] != INVALID_SOCKET )
+#endif /* HAVE_WINSOCK */
+               tcp_close( SLAP_FD2SOCK(wake_sds[1]) );
+#ifdef HAVE_WINSOCK
+       if ( wake_sds[0] != INVALID_SOCKET )
+#endif /* HAVE_WINSOCK */
+               tcp_close( SLAP_FD2SOCK(wake_sds[0]) );
        sockdestroy();
 
 #ifdef HAVE_SLP