From: Howard Chu Date: Thu, 28 Oct 1999 07:17:08 +0000 (+0000) Subject: Fix Winsock-related warning and/or bugs. X-Git-Tag: UCDATA_2_4~299 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=74d93ac2f862f15ac20ad48e0887e2f7edd0fd04;p=openldap Fix Winsock-related warning and/or bugs. See README 1.27 log --- diff --git a/libraries/liblber/sockbuf.c b/libraries/liblber/sockbuf.c index 30bceb6bed..976f9aa56b 100644 --- a/libraries/liblber/sockbuf.c +++ b/libraries/liblber/sockbuf.c @@ -891,9 +891,17 @@ stream_read( Sockbuf *sb, void *buf, ber_len_t len ) { int rc; rc = recv( ber_pvt_sb_get_desc(sb), buf, len, 0 ); + #ifdef HAVE_WINSOCK - if ( rc < 0 ) errno = WSAGetLastError(); + if ( rc < 0 ) + { + int err; + + err = WSAGetLastError(); + errno = err; + } #endif + return rc; } #elif defined( HAVE_NCSA ) @@ -938,7 +946,12 @@ stream_write( Sockbuf *sb, void *buf, ber_len_t len ) int rc; rc = send( ber_pvt_sb_get_desc(sb), buf, len, 0 ); #ifdef HAVE_WINSOCK - if ( rc < 0 ) errno = WSAGetLastError(); + if ( rc < 0 ) + { + int err; + err = WSAGetLastError(); + errno = err; + } #endif return rc; } diff --git a/libraries/libldap/tmplout.c b/libraries/libldap/tmplout.c index 280e762965..e804fe0be7 100644 --- a/libraries/libldap/tmplout.c +++ b/libraries/libldap/tmplout.c @@ -12,6 +12,7 @@ #include +#include #include #include diff --git a/libraries/liblutil/nt_err.c b/libraries/liblutil/nt_err.c index 6d119d2b3d..15c9ec573c 100644 --- a/libraries/liblutil/nt_err.c +++ b/libraries/liblutil/nt_err.c @@ -1,8 +1,10 @@ /* $OpenLDAP$ */ #include "portable.h" -#ifdef HAVE_WINSOCK2 -#include +#include + +#ifdef HAVE_WINSOCK +#include #define __RETSTR( x ) case x: return #x; @@ -57,6 +59,8 @@ char *WSAGetErrorString( int err ) __RETSTR( WSAVERNOTSUPPORTED ) __RETSTR( WSANOTINITIALISED ) __RETSTR( WSAEDISCON ) + +#ifdef HAVE_WINSOCK2 __RETSTR( WSAENOMORE ) __RETSTR( WSAECANCELLED ) __RETSTR( WSAEINVALIDPROCTABLE ) @@ -67,6 +71,7 @@ char *WSAGetErrorString( int err ) __RETSTR( WSA_E_NO_MORE ) __RETSTR( WSA_E_CANCELLED ) __RETSTR( WSAEREFUSED ) +#endif // HAVE_WINSOCK2 __RETSTR( WSAHOST_NOT_FOUND ) __RETSTR( WSATRY_AGAIN ) @@ -83,7 +88,7 @@ char *WSAGetLastErrorString( void ) #undef __RETSTR -#endif /* HAVE_WINSOCK2 */ +#endif /* HAVE_WINSOCK */ char *GetErrorString( int err )