From: Kurt Zeilenga Date: Mon, 28 Aug 2000 22:24:01 +0000 (+0000) Subject: Use shutdown(2) prior to stream close(2). X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~2154 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5d9f41e8dc233e627d194b1bfd1cab91305cd44d;p=openldap Use shutdown(2) prior to stream close(2). --- diff --git a/include/ac/socket.h b/include/ac/socket.h index 027ed88765..8ab6dfe74e 100644 --- a/include/ac/socket.h +++ b/include/ac/socket.h @@ -83,6 +83,12 @@ # define ioctl_t u_long # define AC_SOCKET_INVALID ((unsigned int) ~0) +# if SD_BOTH +# define tcp_close( s ) (shutdown( s, SD_BOTH ), closesocket( s )) +#else +# define tcp_close( s ) closesocket( s ) +#endif + #define EWOULDBLOCK WSAEWOULDBLOCK #define EINPROGRESS WSAEINPROGRESS #define ETIMEDOUT WSAETIMEDOUT @@ -120,10 +126,15 @@ LBER_F( char * ) ber_pvt_wsa_err2string LDAP_P((int)); # endif #else -# define tcp_close( s ) close( s ) # define tcp_read( s, buf, len) read( s, buf, len ) # define tcp_write( s, buf, len) write( s, buf, len ) +# if SHUT_RDWR +# define tcp_close( s ) (shutdown( s, SHUT_RDWR ), close( s )) +#else +# define tcp_close( s ) close( s ) +#endif + #ifdef HAVE_PIPE /* * Only use pipe() on systems where file and socket descriptors