Bruno Jesus : ws2_32: Ensure sockets in exceptfds get set when an error occurs.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Mar 30 10:12:57 CDT 2015
Module: wine
Branch: master
Commit: b2556a2c34f36c0c82f028dbf24acb1ed77cce29
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b2556a2c34f36c0c82f028dbf24acb1ed77cce29
Author: Bruno Jesus <00cpxxx at gmail.com>
Date: Sun Mar 29 00:53:43 2015 -0300
ws2_32: Ensure sockets in exceptfds get set when an error occurs.
---
dlls/ws2_32/socket.c | 16 +---------------
dlls/ws2_32/tests/sock.c | 4 ++--
2 files changed, 3 insertions(+), 17 deletions(-)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 0b8e2cb..26ac305 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -1124,15 +1124,6 @@ static char *strdup_lower(const char *str)
return ret;
}
-static inline int sock_error_p(int s)
-{
- unsigned int optval;
- socklen_t optlen = sizeof(optval);
- getsockopt(s, SOL_SOCKET, SO_ERROR, (void *) &optval, &optlen);
- if (optval) WARN("\t[%i] error: %d\n", s, optval);
- return optval != 0;
-}
-
/* Utility: get the SO_RCVTIMEO or SO_SNDTIMEO socket option
* from an fd and return the value converted to milli seconds
* or -1 if there is an infinite time out */
@@ -4545,12 +4536,7 @@ static void release_poll_fds( const WS_fd_set *readfds, const WS_fd_set *writefd
if (exceptfds)
{
for (i = 0; i < exceptfds->fd_count; i++, j++)
- if (fds[j].fd != -1)
- {
- /* make sure we have a real error before releasing the fd */
- if (!sock_error_p( fds[j].fd )) fds[j].revents = 0;
- release_sock_fd( exceptfds->fd_array[i], fds[j].fd );
- }
+ if (fds[j].fd != -1) release_sock_fd( exceptfds->fd_array[i], fds[j].fd );
}
}
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index 638a767..87511aa 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -3437,8 +3437,10 @@ static void test_select(void)
}
ok ( !FD_ISSET(fdWrite, &writefds), "FD should not be set\n");
+ todo_wine {
ok ( !FD_ISSET(fdRead, &exceptfds), "FD should not be set\n");
ok ( !FD_ISSET(fdWrite, &exceptfds), "FD should not be set\n");
+ }
ok ((listen(fdWrite, SOMAXCONN) == SOCKET_ERROR), "listen did not fail\n");
ret = closesocket(fdWrite);
@@ -3683,9 +3685,7 @@ todo_wine
FD_SET(fdWrite, &exceptfds);
select_timeout.tv_sec = 2; /* requires more time to realize it will not connect */
ret = select(0, &readfds, &writefds, &exceptfds, &select_timeout);
-todo_wine
ok(ret == 1, "expected 1, got %d\n", ret);
-todo_wine
ok(FD_ISSET(fdWrite, &exceptfds), "fdWrite socket is not in the set\n");
ok(select_timeout.tv_usec == 250000, "select timeout should not have changed\n");
closesocket(fdWrite);
More information about the wine-cvs
mailing list