mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-01 04:29:35 -05:00
Fix Winsock-related warning and/or bugs.
See README 1.27 log
This commit is contained in:
parent
adaecb2a9f
commit
74d93ac2f8
3 changed files with 24 additions and 5 deletions
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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 )
|
||||
|
|
|
|||
Loading…
Reference in a new issue