Commit bebc425b authored by Bruno Jesus's avatar Bruno Jesus Committed by Alexandre Julliard

ws2_32: Fix false-positive write fds on select().

parent 6ee95c77
...@@ -3661,7 +3661,8 @@ static int get_poll_results( WS_fd_set *readfds, WS_fd_set *writefds, WS_fd_set ...@@ -3661,7 +3661,8 @@ static int get_poll_results( WS_fd_set *readfds, WS_fd_set *writefds, WS_fd_set
if (writefds) if (writefds)
{ {
for (i = k = 0; i < writefds->fd_count; i++, j++) 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; writefds->fd_count = k;
total += k; total += k;
} }
......
...@@ -2311,7 +2311,7 @@ static void test_errors(void) ...@@ -2311,7 +2311,7 @@ static void test_errors(void)
timeval.tv_usec = 50000; timeval.tv_usec = 50000;
ret = select(1, NULL, &set, NULL, &timeval); 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); ret = closesocket(sock);
...@@ -2353,8 +2353,8 @@ static void test_select(void) ...@@ -2353,8 +2353,8 @@ static void test_select(void)
ret = select(maxfd+1, &readfds, &writefds, &exceptfds, &select_timeout); ret = select(maxfd+1, &readfds, &writefds, &exceptfds, &select_timeout);
ok ( (ret == 0), "select should not return any socket handles\n"); 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(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(fdRead, &exceptfds), "FD should not be set\n");
ok ( !FD_ISSET(fdWrite, &exceptfds), "FD should not be set\n"); ok ( !FD_ISSET(fdWrite, &exceptfds), "FD should not be set\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment