server: Return failure in bind if the address is not found.

This commit is contained in:
Gabriel Brand 2024-01-01 00:27:59 +01:00 committed by Alexandre Julliard
parent b7f06a4a19
commit 6361a20c52
2 changed files with 1 additions and 3 deletions

View file

@ -12528,9 +12528,7 @@ static void test_bind(void)
WSASetLastError(0xdeadbeef);
ret = bind(s, (const struct sockaddr *)&invalid_addr, sizeof(invalid_addr));
todo_wine
ok(ret == -1, "expected failure\n");
todo_wine
ok(WSAGetLastError() == WSAEADDRNOTAVAIL, "got error %u\n", WSAGetLastError());
WSASetLastError(0xdeadbeef);

View file

@ -2231,7 +2231,7 @@ static int bind_to_interface( struct sock *sock, const struct sockaddr_in *addr
in_addr_t bind_addr = addr->sin_addr.s_addr;
struct ifaddrs *ifaddrs, *ifaddr;
int fd = get_unix_fd( sock->fd );
int err = 0;
int err = -1;
if (bind_addr == htonl( INADDR_ANY ) || bind_addr == htonl( INADDR_LOOPBACK ))
return 0;