ws2_32: Do not make the unix file descriptor blocking. Too many places in the socket code assume it is not.

Rein Klazes wijn at online.nl
Fri Jul 24 03:29:17 CDT 2009


As discussed on the devel list. Fixes bug #12048.
---
 dlls/ws2_32/socket.c |   24 +++++-------------------
 1 files changed, 5 insertions(+), 19 deletions(-)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 1492640..2eb5837 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -2406,25 +2406,11 @@ int WINAPI WS_ioctlsocket(SOCKET s, LONG cmd, WS_u_long *argp)
             SetLastError(WSAEINVAL);
             return SOCKET_ERROR;
         }
-        fd = get_sock_fd( s, 0, NULL );
-        if (fd != -1)
-        {
-            int ret;
-            if (*argp)
-            {
-                _enable_event(SOCKET2HANDLE(s), 0, FD_WINE_NONBLOCKING, 0);
-                ret = fcntl( fd, F_SETFL, O_NONBLOCK );
-            }
-            else
-            {
-                _enable_event(SOCKET2HANDLE(s), 0, 0, FD_WINE_NONBLOCKING);
-                ret = fcntl( fd, F_SETFL, 0 );
-            }
-            release_sock_fd( s, fd );
-            if (!ret) return 0;
-            SetLastError((errno == EBADF) ? WSAENOTSOCK : wsaErrno());
-        }
-        return SOCKET_ERROR;
+        if (*argp)
+            _enable_event(SOCKET2HANDLE(s), 0, FD_WINE_NONBLOCKING, 0);
+        else
+            _enable_event(SOCKET2HANDLE(s), 0, 0, FD_WINE_NONBLOCKING);
+        return 0;
 
     case WS_SIOCATMARK:
         newcmd=SIOCATMARK;
-- 
1.6.3.3




More information about the wine-patches mailing list