From: Howard Chu Date: Wed, 21 Jul 2010 23:41:17 +0000 (+0000) Subject: ITS#6585 don't close invalid sockets X-Git-Tag: MIGRATION_CVS2GIT~546 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=512c7ca2732118149c3ee4b23980fe03d29077b2;p=openldap ITS#6585 don't close invalid sockets --- diff --git a/libraries/liblber/sockbuf.c b/libraries/liblber/sockbuf.c index e1d9e4536a..5bd0a1d164 100644 --- a/libraries/liblber/sockbuf.c +++ b/libraries/liblber/sockbuf.c @@ -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; }