Module: wine Branch: master Commit: 41cdc6674cd5882adc151ec7f4199c6b11c9227f URL: https://gitlab.winehq.org/wine/wine/-/commit/41cdc6674cd5882adc151ec7f4199c6...
Author: Zebediah Figura zfigura@codeweavers.com Date: Mon Jul 11 23:38:34 2022 -0500
server: Report the socket error in sock_poll_event() on POLLERR or POLLHUP.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52815
---
dlls/ws2_32/tests/afd.c | 3 ++- server/sock.c | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/dlls/ws2_32/tests/afd.c b/dlls/ws2_32/tests/afd.c index 9852d54ecb9..eb525c78c54 100644 --- a/dlls/ws2_32/tests/afd.c +++ b/dlls/ws2_32/tests/afd.c @@ -162,7 +162,8 @@ static void check_poll_(int line, SOCKET s, HANDLE event, int mask, int expect, ok_(__FILE__, line)(out_params.count == 1, "got count %u\n", out_params.count); ok_(__FILE__, line)(out_params.sockets[0].socket == s, "got socket %#Ix\n", out_params.sockets[0].socket); todo_wine_if (todo) ok_(__FILE__, line)(out_params.sockets[0].flags == expect, "got flags %#x\n", out_params.sockets[0].flags); - ok_(__FILE__, line)(!out_params.sockets[0].status, "got status %#x\n", out_params.sockets[0].status); + todo_wine_if (expect & AFD_POLL_RESET) + ok_(__FILE__, line)(!out_params.sockets[0].status, "got status %#x\n", out_params.sockets[0].status); }
static void test_poll(void) diff --git a/server/sock.c b/server/sock.c index 373236cab56..a8c0b56c2bc 100644 --- a/server/sock.c +++ b/server/sock.c @@ -1145,6 +1145,9 @@ static void sock_poll_event( struct fd *fd, int event ) if (debug_level) fprintf(stderr, "socket %p select event: %x\n", sock, event);
+ if (event & (POLLERR | POLLHUP)) + error = sock_error( sock ); + switch (sock->state) { case SOCK_UNCONNECTED: @@ -1153,7 +1156,6 @@ static void sock_poll_event( struct fd *fd, int event ) case SOCK_CONNECTING: if (event & (POLLERR|POLLHUP)) { - error = sock_error( sock ); sock->state = SOCK_UNCONNECTED; event &= ~POLLOUT; } @@ -1166,8 +1168,6 @@ static void sock_poll_event( struct fd *fd, int event ) break;
case SOCK_LISTENING: - if (event & (POLLERR|POLLHUP)) - error = sock_error( sock ); break;
case SOCK_CONNECTED: