ws2_32: Ensure sockets in exceptfds get set when an error occurs.
This commit is contained in:
parent
57e7a562bd
commit
b2556a2c34
|
@ -1124,15 +1124,6 @@ static char *strdup_lower(const char *str)
|
||||||
return ret;
|
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
|
/* Utility: get the SO_RCVTIMEO or SO_SNDTIMEO socket option
|
||||||
* from an fd and return the value converted to milli seconds
|
* from an fd and return the value converted to milli seconds
|
||||||
* or -1 if there is an infinite time out */
|
* 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)
|
if (exceptfds)
|
||||||
{
|
{
|
||||||
for (i = 0; i < exceptfds->fd_count; i++, j++)
|
for (i = 0; i < exceptfds->fd_count; i++, j++)
|
||||||
if (fds[j].fd != -1)
|
if (fds[j].fd != -1) release_sock_fd( exceptfds->fd_array[i], fds[j].fd );
|
||||||
{
|
|
||||||
/* 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 );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3437,8 +3437,10 @@ static void test_select(void)
|
||||||
}
|
}
|
||||||
ok ( !FD_ISSET(fdWrite, &writefds), "FD should not be set\n");
|
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(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");
|
||||||
|
}
|
||||||
|
|
||||||
ok ((listen(fdWrite, SOMAXCONN) == SOCKET_ERROR), "listen did not fail\n");
|
ok ((listen(fdWrite, SOMAXCONN) == SOCKET_ERROR), "listen did not fail\n");
|
||||||
ret = closesocket(fdWrite);
|
ret = closesocket(fdWrite);
|
||||||
|
@ -3683,9 +3685,7 @@ todo_wine
|
||||||
FD_SET(fdWrite, &exceptfds);
|
FD_SET(fdWrite, &exceptfds);
|
||||||
select_timeout.tv_sec = 2; /* requires more time to realize it will not connect */
|
select_timeout.tv_sec = 2; /* requires more time to realize it will not connect */
|
||||||
ret = select(0, &readfds, &writefds, &exceptfds, &select_timeout);
|
ret = select(0, &readfds, &writefds, &exceptfds, &select_timeout);
|
||||||
todo_wine
|
|
||||||
ok(ret == 1, "expected 1, got %d\n", ret);
|
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(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");
|
ok(select_timeout.tv_usec == 250000, "select timeout should not have changed\n");
|
||||||
closesocket(fdWrite);
|
closesocket(fdWrite);
|
||||||
|
|
Loading…
Reference in New Issue