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

Alexandre Julliard julliard at winehq.org
Fri Jul 24 08:49:40 CDT 2009


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

Author: Rein Klazes <wijn at online.nl>
Date:   Fri Jul 24 10:29:17 2009 +0200

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

---

 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;




More information about the wine-cvs mailing list