Alex Henrie : ws2_32: Set WSAEFAULT if the bind address is null.
Alexandre Julliard
julliard at winehq.org
Mon Oct 18 16:16:30 CDT 2021
Module: wine
Branch: master
Commit: a990e25bf029913b08590d89841ec4faa89236b6
URL: https://source.winehq.org/git/wine.git/?a=commit;h=a990e25bf029913b08590d89841ec4faa89236b6
Author: Alex Henrie <alexhenrie24 at gmail.com>
Date: Sun Oct 17 23:45:29 2021 -0600
ws2_32: Set WSAEFAULT if the bind address is null.
Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ws2_32/socket.c | 2 +-
dlls/ws2_32/tests/sock.c | 13 ++++++++++++-
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 50ea15c5b0e..2db441bee3c 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -1068,7 +1068,7 @@ int WINAPI bind( SOCKET s, const struct sockaddr *addr, int len )
if (!addr)
{
- SetLastError( WSAEAFNOSUPPORT );
+ SetLastError( WSAEFAULT );
return -1;
}
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index eadc47a8ea6..63f8149f160 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -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);
More information about the wine-cvs
mailing list