Confusing SOCKET and int in netapi32

Juan Lang juan.lang at gmail.com
Mon Mar 24 10:32:29 CDT 2008


Hi, commit 63504e9e80acb35666f8689526c67dd99c4fb3ba (janitorial: Use
poll() instead of select().) appears to confuse the use of a SOCKET
with an int:

 #include "winsock2.h"
 #include "windef.h"
@@ -302,13 +311,12 @@ static UCHAR NetBTWaitForNameResponse(const
NetBTAdapter *adapter, SOCKET fd,
     while (!found && ret == NRC_GOODRET && (now = GetTickCount()) < waitUntil)
     {
         DWORD msToWait = waitUntil - now;
-        struct fd_set fds;
-        struct timeval timeout = { msToWait / 1000, msToWait % 1000 };
+        struct pollfd pfd;
         int r;

-        FD_ZERO(&fds);
-        FD_SET(fd, &fds);
-        r = select(fd + 1, &fds, NULL, NULL, &timeout);
+        pfd.fd = fd;
+        pfd.events = POLLIN;
+        r = poll(&pfd, 1, msToWait);

I can't imagine how this could work.  Notice that netapi32 is linked
against ws2_32, includes winsock2.h, and that fd is a SOCKET.  Could
this part of the commit be reverted, please?
--Juan



More information about the wine-devel mailing list