Commit 998febf7 authored by Ally Sommers's avatar Ally Sommers Committed by Alexandre Julliard

server: Return WSAEOPNOTSUPP on listen() if the socket's type is SOCK_DGRAM.

parent bf6f255c
......@@ -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() );
......
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment