]> git.sur5r.net Git - openldap/commitdiff
ITS#6585 don't close invalid sockets
authorHoward Chu <hyc@openldap.org>
Wed, 21 Jul 2010 23:41:17 +0000 (23:41 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 21 Jul 2010 23:41:17 +0000 (23:41 +0000)
libraries/liblber/sockbuf.c

index e1d9e4536a6c1900137e30fdf8f8b52e98e2f9b3..5bd0a1d1643087653c182d52e82eb1f6cc38765e 100644 (file)
@@ -541,7 +541,8 @@ sb_stream_close( Sockbuf_IO_Desc *sbiod )
 {
        assert( sbiod != NULL );
        assert( SOCKBUF_VALID( sbiod->sbiod_sb ) );
-       tcp_close( sbiod->sbiod_sb->sb_fd );
+       if ( sbiod->sbiod_sb->sb_fd != AC_SOCKET_INVALID )
+               tcp_close( sbiod->sbiod_sb->sb_fd );
    return 0;
 }
 
@@ -754,7 +755,8 @@ sb_fd_close( Sockbuf_IO_Desc *sbiod )
        assert( sbiod != NULL );
        assert( SOCKBUF_VALID( sbiod->sbiod_sb ) );
 
-       close( sbiod->sbiod_sb->sb_fd );
+       if ( sbiod->sbiod_sb->sb_fd != AC_SOCKET_INVALID )
+               close( sbiod->sbiod_sb->sb_fd );
        return 0;
 }
 
@@ -956,8 +958,9 @@ sb_dgram_close( Sockbuf_IO_Desc *sbiod )
 {
        assert( sbiod != NULL );
        assert( SOCKBUF_VALID( sbiod->sbiod_sb ) );
-
-       tcp_close( sbiod->sbiod_sb->sb_fd );
+  
+       if ( sbiod->sbiod_sb->sb_fd != AC_SOCKET_INVALID )
+               tcp_close( sbiod->sbiod_sb->sb_fd );
        return 0;
 }