{
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 )
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;
}
/* $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;
__RETSTR( WSAVERNOTSUPPORTED )
__RETSTR( WSANOTINITIALISED )
__RETSTR( WSAEDISCON )
+
+#ifdef HAVE_WINSOCK2
__RETSTR( WSAENOMORE )
__RETSTR( WSAECANCELLED )
__RETSTR( WSAEINVALIDPROCTABLE )
__RETSTR( WSA_E_NO_MORE )
__RETSTR( WSA_E_CANCELLED )
__RETSTR( WSAEREFUSED )
+#endif // HAVE_WINSOCK2
__RETSTR( WSAHOST_NOT_FOUND )
__RETSTR( WSATRY_AGAIN )
#undef __RETSTR
-#endif /* HAVE_WINSOCK2 */
+#endif /* HAVE_WINSOCK */
char *GetErrorString( int err )