ws2_32: Set SO_REUSEPORT in addition to SO_REUSEADDR on MacOS.

Hans Leidekker hans at codeweavers.com
Fri Jan 11 10:22:59 CST 2013


---
 dlls/ws2_32/socket.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index eeb5265..c390828 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -4452,6 +4452,15 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname,
 
     if (setsockopt(fd, level, optname, optval, optlen) == 0)
     {
+#ifdef __APPLE__
+        if (level == SOL_SOCKET && optname == SO_REUSEADDR &&
+            setsockopt(fd, level, SO_REUSEPORT, optval, optlen) != 0)
+        {
+            SetLastError(wsaErrno());
+            release_sock_fd( s, fd );
+            return SOCKET_ERROR;
+        }
+#endif
         release_sock_fd( s, fd );
         return 0;
     }
-- 
1.7.10.4






More information about the wine-patches mailing list