fix PR#2261 in a different way

This commit is contained in:
Dr. Stephen Henson 2010-05-31 13:17:52 +00:00
parent 18394ed50f
commit 60a989a76e
2 changed files with 7 additions and 4 deletions

View file

@ -659,7 +659,14 @@ again:
#ifdef SO_REUSEADDR #ifdef SO_REUSEADDR
err_num=get_last_socket_error(); err_num=get_last_socket_error();
if ((bind_mode == BIO_BIND_REUSEADDR_IF_UNUSED) && if ((bind_mode == BIO_BIND_REUSEADDR_IF_UNUSED) &&
#ifdef OPENSSL_SYS_WINDOWS
/* Some versions of Windows define EADDRINUSE to
* a dummy value.
*/
(err_num == WSAEADDRINUSE))
#else
(err_num == EADDRINUSE)) (err_num == EADDRINUSE))
#endif
{ {
memcpy((char *)&client,(char *)&server,sizeof(server)); memcpy((char *)&client,(char *)&server,sizeof(server));
if (strcmp(h,"*") == 0) if (strcmp(h,"*") == 0)

4
e_os.h
View file

@ -153,10 +153,6 @@ extern "C" {
#define clear_socket_error() WSASetLastError(0) #define clear_socket_error() WSASetLastError(0)
#define readsocket(s,b,n) recv((s),(b),(n),0) #define readsocket(s,b,n) recv((s),(b),(n),0)
#define writesocket(s,b,n) send((s),(b),(n),0) #define writesocket(s,b,n) send((s),(b),(n),0)
#ifdef EADDRINUSE
#undef EADDRINUSE
#endif
#define EADDRINUSE WSAEADDRINUSE
#elif defined(__DJGPP__) #elif defined(__DJGPP__)
#define WATT32 #define WATT32
#define get_last_socket_error() errno #define get_last_socket_error() errno