X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Funit%2Ftest_unix_socket.c;fp=tests%2Funit%2Ftest_unix_socket.c;h=8752ba94151e9fde22ff34f636ec275d759ddc10;hp=0a96fb589021cc94d2305e7e744d5e3670e9b021;hb=94dbb7f27f34656ea8a4caa8a3085f69fe7ba5ea;hpb=70eb2f6fb8b5ee08fce4c970a498c0cdc3e69bf3 diff --git a/tests/unit/test_unix_socket.c b/tests/unit/test_unix_socket.c index 0a96fb589..8752ba941 100644 --- a/tests/unit/test_unix_socket.c +++ b/tests/unit/test_unix_socket.c @@ -641,13 +641,6 @@ error: } if (fork_ret == 0) { - if (child_connection_socket >= 0) { - ret = close(child_connection_socket); - if (ret) { - PERROR("Failed to close child connection socket"); - } - } - /* Prevent libtap from printing a result for the child. */ fclose(stdout); fclose(stderr); @@ -655,6 +648,13 @@ error: /* Child exits at the end of this test. */ exit(0); } else if (parent_socket >= 0) { + if (child_connection_socket >= 0) { + ret = close(child_connection_socket); + if (ret) { + PERROR("Failed to close child connection socket"); + } + } + ret = unlink(socket_path); if (ret) { PERROR("Failed to unlink socket at path `%s`",