On Mon, Jan 24, 2011 at 12:21:15AM -0500, Mike Kaplinskiy wrote:
> For some reason the newer kernels report POLLOUT|POLLERR|POLLHUP when
> connect() fails. Strip the POLLOUT in this case. This (hopefully)
> fixes bug 25456.
> diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
> index 1b81544..3c6425e 100644
> --- a/dlls/ws2_32/tests/sock.c
> +++ b/dlls/ws2_32/tests/sock.c
> @@ -3965,7 +3965,7 @@ static void test_ConnectEx(void)
> closesocket(listener);
> listener = INVALID_SOCKET;
>
> - address.sin_port = 1;
> + address.sin_port = htons(1);
>
> bret = pConnectEx(connector, (struct sockaddr*)&address, addrlen, NULL, 0, &bytesReturned, &overlapped);
> ok(bret == FALSE && GetLastError(), "ConnectEx to bad destination failed: "
> diff --git a/server/sock.c b/server/sock.c
> index d37a316..134efb0 100644
> --- a/server/sock.c
> +++ b/server/sock.c
> @@ -388,6 +388,9 @@ static void sock_poll_event( struct fd *fd, int event )
>
> if (sock->state & FD_CONNECT)
> {
> + if (event & POLLOUT && event & (POLLERR|POLLHUP))
> + event &= ~POLLOUT;
Add more braces to make the operator precedence a bit more clear...
(just a style issue though)
Ciao, Marcus