Bruno Jesus : ws2_32: Fix false-positive write fds on select().
Alexandre Julliard
julliard at winehq.org
Wed Aug 24 14:05:17 CDT 2011
Module: wine
Branch: master
Commit: bebc425bb52fde72611a767c732b0214074b3f17
URL: http://source.winehq.org/git/wine.git/?a=commit;h=bebc425bb52fde72611a767c732b0214074b3f17
Author: Bruno Jesus <00cpxxx at gmail.com>
Date: Fri Aug 5 01:04:06 2011 -0300
ws2_32: Fix false-positive write fds on select().
---
dlls/ws2_32/socket.c | 3 ++-
dlls/ws2_32/tests/sock.c | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index eafaefd..a51b921 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -3661,7 +3661,8 @@ static int get_poll_results( WS_fd_set *readfds, WS_fd_set *writefds, WS_fd_set
if (writefds)
{
for (i = k = 0; i < writefds->fd_count; i++, j++)
- if (fds[j].revents) writefds->fd_array[k++] = writefds->fd_array[i];
+ if ((fds[j].revents & POLLOUT) && !(fds[j].revents & POLLHUP))
+ writefds->fd_array[k++] = writefds->fd_array[i];
writefds->fd_count = k;
total += k;
}
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index a171c85..9e6912c 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -2311,7 +2311,7 @@ static void test_errors(void)
timeval.tv_usec = 50000;
ret = select(1, NULL, &set, NULL, &timeval);
- todo_wine ok( (ret == 0), "expected 0 (timeout), got: %d\n", ret );
+ ok( (ret == 0), "expected 0 (timeout), got: %d\n", ret );
}
ret = closesocket(sock);
@@ -2353,8 +2353,8 @@ static void test_select(void)
ret = select(maxfd+1, &readfds, &writefds, &exceptfds, &select_timeout);
ok ( (ret == 0), "select should not return any socket handles\n");
ok ( !FD_ISSET(fdRead, &readfds), "FD should not be set\n");
- ok ( !FD_ISSET(fdWrite, &writefds), "FD should not be set\n");
}
+ ok ( !FD_ISSET(fdWrite, &writefds), "FD should not be set\n");
ok ( !FD_ISSET(fdRead, &exceptfds), "FD should not be set\n");
ok ( !FD_ISSET(fdWrite, &exceptfds), "FD should not be set\n");
More information about the wine-cvs
mailing list