On Windows, `listen()` throws `WSAEOPNOTSUPP` when provided with a `SOCK_DGRAM` socket. Wine currently only throws `WSAEOPNOTSUPP` if the socket is bound; otherwise it throws `WSAEINVAL`. This patch modifies the `IOCTL_AFD_LISTEN` case in wineserver's `sock_ioctl()` throw `WSAEOPNOTSUPP` if it's passed an unbound `SOCK_DGRAM` socket.
From: Ally Sommers dropbear.sh@gmail.com
--- dlls/ws2_32/tests/sock.c | 12 ++++++++++++ server/sock.c | 6 ++++++ 2 files changed, 18 insertions(+)
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index 31dff1a11c7..5ab21060a62 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -3945,6 +3945,18 @@ static void test_listen(void) ret = WSAGetLastError(); ok (ret == WSAENOTSOCK, "expected 10038, received %d\n", ret);
+ /* udp test */ + SetLastError(0xdeadbeef); + fdA = socket(AF_INET, SOCK_DGRAM, 0); + ok ((fdA != INVALID_SOCKET), "socket failed unexpectedly: %d\n", WSAGetLastError() ); + + ok ((listen(fdA, 1) == SOCKET_ERROR), "listen did not fail\n"); + ret = WSAGetLastError(); + ok (ret == WSAEOPNOTSUPP, "expected 10045, received %d\n", ret); + + ret = closesocket(fdA); + ok (ret == 0, "closesocket failed unexpectedly: %d\n", ret); + /* tcp tests */ fdA = socket(AF_INET, SOCK_STREAM, 0); ok ((fdA != INVALID_SOCKET), "socket failed unexpectedly: %d\n", WSAGetLastError() ); diff --git a/server/sock.c b/server/sock.c index ac55a5448f7..52175b08987 100644 --- a/server/sock.c +++ b/server/sock.c @@ -2533,6 +2533,12 @@ static void sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) return; }
+ if (sock->type == WS_SOCK_DGRAM) + { + set_error( STATUS_NOT_SUPPORTED ); + return; + } + if (!sock->bound) { set_error( STATUS_INVALID_PARAMETER );
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=137545
Your paranoid android.
=== debian11b (64 bit WoW report) ===
Report validation errors: xinput1_3:xinput crashed (c0000005)