From 512c7ca2732118149c3ee4b23980fe03d29077b2 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Wed, 21 Jul 2010 23:41:17 +0000 Subject: [PATCH] ITS#6585 don't close invalid sockets --- libraries/liblber/sockbuf.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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; } -- 2.39.5