On Tue, Sep 6, 2016 at 10:38 PM, Alistair Leslie-Hughes leslie_alistair@hotmail.com wrote:
Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com
dlls/ws2_32/socket.c | 2 +- dlls/ws2_32/tests/sock.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index 79ccfc2..38fa62f 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -2653,7 +2653,7 @@ SOCKET WINAPI WS_accept(SOCKET s, struct WS_sockaddr *addr, int *addrlen32) SERVER_END_REQ; if (!status) {
if (addr && WS_getpeername(as, addr, addrlen32))
if (addr && addrlen32 && WS_getpeername(as, addr, addrlen32)) { WS_closesocket(as); return SOCKET_ERROR;
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index 2640dd4..8c6ca29 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -4200,6 +4200,15 @@ static void test_accept(void) ok(socklen != sizeof(ss), "unexpected length\n"); ok(ss.ss_family, "family not set\n");
Hi, I have the impression that you are leaking the accepted and connector socket from previous tests, can you please check?
- socklen = sizeof(address);
- connector = setup_connector_socket(&address, socklen, FALSE);
- if (connector == INVALID_SOCKET) goto done;
- memset(&ss, 0, sizeof(ss));
- accepted = accept(server_socket, (struct sockaddr *)&ss, NULL);
- ok(accepted != INVALID_SOCKET, "Failed to accept connection, %d\n", WSAGetLastError());
- ok(!ss.ss_family, "family not set\n");
I believe the comment should be "family set\n", right? But actually your change suggests that the whole structure should be left unmodified so I believe it's better to test the whole structure to ensure the change is fully tested. You could add ss_empty variable, memset it to zero and memcmp both.
Please fix the subject ;-)
Best wishes, Bruno