fix PR#2261 in a different way
authorDr. Stephen Henson <steve@openssl.org>
Mon, 31 May 2010 13:18:21 +0000 (13:18 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Mon, 31 May 2010 13:18:21 +0000 (13:18 +0000)
crypto/bio/b_sock.c
e_os.h

index 5ea621c0cf865c8202b5313ede04459fe9c8c44c..12b0a53a81c4fe066f6304b24fa32c94764f52d4 100644 (file)
@@ -731,7 +731,14 @@ again:
 #ifdef SO_REUSEADDR
                err_num=get_last_socket_error();
                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))
+#endif
                        {
                        client = server;
                        if (h == NULL || strcmp(h,"*") == 0)
diff --git a/e_os.h b/e_os.h
index 48ed6bdff4d7af1cdd2d8dbdfd49483ceb0cd8cc..5ceeeeb950d6f9132deac10407078d10a294394c 100644 (file)
--- a/e_os.h
+++ b/e_os.h
@@ -150,10 +150,6 @@ extern "C" {
 #define clear_socket_error()   WSASetLastError(0)
 #define readsocket(s,b,n)      recv((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__)
 #define WATT32
 #define get_last_socket_error()        errno