X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fmain.c;h=fc52d759b2130b8f1bdd2e122f24c1990f9b85d2;hp=90f11d648e537fee78cbb88506dc6e026f675909;hb=35df275583d85652cb5132adb9416e32175524e7;hpb=ae9e45b342636e7b42eafc15cd105bccfbbbe373 diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 90f11d648..fc52d759b 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -3111,7 +3111,7 @@ static void *thread_manage_clients(void *data) ret = lttcomm_listen_unix_sock(client_sock); if (ret < 0) { - goto error; + goto error_listen; } /* @@ -3120,7 +3120,7 @@ static void *thread_manage_clients(void *data) */ ret = create_thread_poll_set(&events, 2); if (ret < 0) { - goto error; + goto error_create_poll; } /* Add the application registration socket */ @@ -3299,13 +3299,18 @@ static void *thread_manage_clients(void *data) exit: error: - if (err) { - health_error(&health_thread_cmd); - ERR("Health error occurred in %s", __func__); + if (sock >= 0) { + ret = close(sock); + if (ret) { + PERROR("close"); + } } - health_exit(&health_thread_cmd); - DBG("Client thread dying"); + lttng_poll_clean(&events); + clean_command_ctx(&cmd_ctx); + +error_listen: +error_create_poll: unlink(client_unix_sock_path); if (client_sock >= 0) { ret = close(client_sock); @@ -3313,15 +3318,15 @@ error: PERROR("close"); } } - if (sock >= 0) { - ret = close(sock); - if (ret) { - PERROR("close"); - } + + if (err) { + health_error(&health_thread_cmd); + ERR("Health error occurred in %s", __func__); } - lttng_poll_clean(&events); - clean_command_ctx(&cmd_ctx); + health_exit(&health_thread_cmd); + + DBG("Client thread dying"); rcu_unregister_thread(); return NULL;