Commit a990e25b authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

ws2_32: Set WSAEFAULT if the bind address is null.

parent 63110f98
......@@ -1068,7 +1068,7 @@ int WINAPI bind( SOCKET s, const struct sockaddr *addr, int len )
if (!addr)
{
SetLastError( WSAEAFNOSUPPORT );
SetLastError( WSAEFAULT );
return -1;
}
......
......@@ -10794,7 +10794,18 @@ static void test_bind(void)
WSASetLastError(0xdeadbeef);
ret = bind(s, NULL, 0);
ok(ret == -1, "expected failure\n");
todo_wine ok(WSAGetLastError() == WSAEFAULT, "got error %u\n", WSAGetLastError());
ok(WSAGetLastError() == WSAEFAULT, "got error %u\n", WSAGetLastError());
WSASetLastError(0xdeadbeef);
ret = bind(s, NULL, sizeof(addr));
ok(ret == -1, "expected failure\n");
ok(WSAGetLastError() == WSAEFAULT, "got error %u\n", WSAGetLastError());
addr.sa_family = AF_INET;
WSASetLastError(0xdeadbeef);
ret = bind(s, &addr, 0);
ok(ret == -1, "expected failure\n");
ok(WSAGetLastError() == WSAEFAULT, "got error %u\n", WSAGetLastError());
addr.sa_family = 0xdead;
WSASetLastError(0xdeadbeef);
......
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