Bruno Jesus : ws2_32: Fix SO_ACCEPTCONN on BSD systems.

Alexandre Julliard julliard at winehq.org
Fri Sep 6 12:39:52 CDT 2013


Module: wine
Branch: master
Commit: b2170d845dda1570967a0f367e0d2222e985bd70
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b2170d845dda1570967a0f367e0d2222e985bd70

Author: Bruno Jesus <00cpxxx at gmail.com>
Date:   Fri Sep  6 09:14:00 2013 -0300

ws2_32: Fix SO_ACCEPTCONN on BSD systems.

---

 dlls/ws2_32/socket.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 38b47fc..d1256c1 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -2855,7 +2855,6 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level,
         {
         /* Handle common cases. The special cases are below, sorted
          * alphabetically */
-        case WS_SO_ACCEPTCONN:
         case WS_SO_BROADCAST:
         case WS_SO_DEBUG:
         case WS_SO_ERROR:
@@ -2875,7 +2874,20 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level,
             }
             release_sock_fd( s, fd );
             return ret;
+        case WS_SO_ACCEPTCONN:
+            if ( (fd = get_sock_fd( s, 0, NULL )) == -1)
+                return SOCKET_ERROR;
+            if (getsockopt(fd, SOL_SOCKET, SO_ACCEPTCONN, optval, (socklen_t *)optlen) != 0 )
+            {
+                SetLastError((errno == EBADF) ? WSAENOTSOCK : wsaErrno());
+                ret = SOCKET_ERROR;
+            }
+
+            /* BSD returns != 0 while Windows return exact == 1 */
+            if (*(int *)optval) *(int *)optval = 1;
 
+            release_sock_fd( s, fd );
+            return ret;
         case WS_SO_DONTLINGER:
         {
             struct linger lingval;




More information about the wine-cvs mailing list