Commit 74d93ac2 authored by Howard Chu's avatar Howard Chu
Browse files

Fix Winsock-related warning and/or bugs.

See README 1.27 log
parent adaecb2a
......@@ -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;
}
......
......@@ -12,6 +12,7 @@
#include <stdio.h>
#include <ac/socket.h>
#include <ac/stdlib.h>
#include <ac/ctype.h>
......
/* $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 )
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment