Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51381 Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/ws2_32/tests/sock.c | 10 +++++----- server/sock.c | 23 ++++++++++++++++++----- 2 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index 3e0ac405447..97b772e12d9 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -6626,14 +6626,14 @@ static void test_connect(void) WSASetLastError(0xdeadbeef); iret = connect(listener, (struct sockaddr *)&address, sizeof(address)); ok(iret == -1, "got %d\n", iret); - todo_wine ok(WSAGetLastError() == WSAEINVAL, "got error %u\n", WSAGetLastError()); + ok(WSAGetLastError() == WSAEINVAL, "got error %u\n", WSAGetLastError());
WSASetLastError(0xdeadbeef); overlapped.Internal = 0xdeadbeef; overlapped.InternalHigh = 0xdeadbeef; iret = pConnectEx(listener, (struct sockaddr *)&address, sizeof(address), NULL, 0, &bytesReturned, &overlapped); ok(!iret, "got %d\n", iret); - todo_wine ok(WSAGetLastError() == WSAEINVAL, "got error %u\n", WSAGetLastError()); + ok(WSAGetLastError() == WSAEINVAL, "got error %u\n", WSAGetLastError()); ok(overlapped.Internal == STATUS_PENDING, "got status %#x\n", (NTSTATUS)overlapped.Internal); todo_wine ok(overlapped.InternalHigh == 0xdeadbeef, "got size %Iu\n", overlapped.InternalHigh);
@@ -6706,7 +6706,7 @@ static void test_connect(void)
WSASetLastError(0xdeadbeef); iret = connect(connector, (struct sockaddr *)&address, sizeof(address)); - todo_wine ok(iret == -1, "got %d\n", iret); + ok(iret == -1, "got %d\n", iret); todo_wine ok(WSAGetLastError() == WSAEINVAL, "got error %u\n", WSAGetLastError());
WSASetLastError(0xdeadbeef); @@ -6740,8 +6740,8 @@ static void test_connect(void)
WSASetLastError(0xdeadbeef); iret = connect(connector, (struct sockaddr *)&address, sizeof(address)); - todo_wine ok(iret == -1, "got %d\n", iret); - todo_wine ok(WSAGetLastError() == WSAEISCONN, "got error %u\n", WSAGetLastError()); + ok(iret == -1, "got %d\n", iret); + ok(WSAGetLastError() == WSAEISCONN, "got error %u\n", WSAGetLastError());
WSASetLastError(0xdeadbeef); iret = connect(acceptor, (struct sockaddr *)&address, sizeof(address)); diff --git a/server/sock.c b/server/sock.c index 5fdbf0bd9ba..3f0526016f9 100644 --- a/server/sock.c +++ b/server/sock.c @@ -2164,12 +2164,25 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) return 0; }
- if (sock->state == SOCK_CONNECTING) + switch (sock->state) { - /* FIXME: STATUS_ADDRESS_ALREADY_ASSOCIATED probably isn't right, - * but there's no status code that maps to WSAEALREADY... */ - set_error( params->synchronous ? STATUS_ADDRESS_ALREADY_ASSOCIATED : STATUS_INVALID_PARAMETER ); - return 0; + case SOCK_LISTENING: + set_error( STATUS_INVALID_PARAMETER ); + return 0; + + case SOCK_CONNECTING: + /* FIXME: STATUS_ADDRESS_ALREADY_ASSOCIATED probably isn't right, + * but there's no status code that maps to WSAEALREADY... */ + set_error( params->synchronous ? STATUS_ADDRESS_ALREADY_ASSOCIATED : STATUS_INVALID_PARAMETER ); + return 0; + + case SOCK_CONNECTED: + set_error( STATUS_CONNECTION_ACTIVE ); + return 0; + + case SOCK_UNCONNECTED: + case SOCK_CONNECTIONLESS: + break; }
unix_len = sockaddr_to_unix( addr, params->addr_len, &unix_addr );