]> git.sur5r.net Git - openldap/commitdiff
Fix Winsock-related warning and/or bugs.
authorHoward Chu <hyc@openldap.org>
Thu, 28 Oct 1999 07:17:08 +0000 (07:17 +0000)
committerHoward Chu <hyc@openldap.org>
Thu, 28 Oct 1999 07:17:08 +0000 (07:17 +0000)
See README 1.27 log

libraries/liblber/sockbuf.c
libraries/libldap/tmplout.c
libraries/liblutil/nt_err.c

index 30bceb6bedcb4197e4b79c478a7d8478aa2a6eff..976f9aa56b32955251af18f761c46a53ca5b47c2 100644 (file)
@@ -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;
    }
index 280e762965661ea36b2368decfdc2fcb777c05d2..e804fe0be74e32349653fd5b8fd69289caeea443 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <stdio.h>
 
+#include <ac/socket.h>
 #include <ac/stdlib.h>
 
 #include <ac/ctype.h>
index 6d119d2b3d7f48094f0f37626d4f8c2c5da480fc..15c9ec573c7b1849320debd5e5162c66a396ad98 100644 (file)
@@ -1,8 +1,10 @@
 /* $OpenLDAP$ */
 #include "portable.h"
 
-#ifdef HAVE_WINSOCK2
-#include <winsock2.h>
+#include <windows.h>
+
+#ifdef HAVE_WINSOCK
+#include <winsock.h>
 
 #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 )