]> git.sur5r.net Git - openldap/blobdiff - libraries/liblber/sockbuf.c
Merge remote branch 'origin/mdb.master'
[openldap] / libraries / liblber / sockbuf.c
index de857922c351aa6b4f1ea04837fafd00d32a82d2..0d1c513b9bcda930aba4fe0c059e59384c3e1249 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2008 The OpenLDAP Foundation.
+ * Copyright 1998-2011 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -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;
 }