summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
ae9e45b)
Currently, if the call to lttcomm_listen_unix_sock or
create_thread_poll_set fails, the error handling and thread teardown
code path is triggered via a jump to an error label. This error handling
path closes the sockets that were used and cleanup the poll set. If the
listen fails, the poll set will tentatively be cleaned even though it
has never been initialized.
This patch add 2 labels to differentiate the error handling paths needed
in case of failure of lttcomm_listen_unix_sock or
create_thread_poll_set.
Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
ret = lttcomm_listen_unix_sock(client_sock);
if (ret < 0) {
ret = lttcomm_listen_unix_sock(client_sock);
if (ret < 0) {
*/
ret = create_thread_poll_set(&events, 2);
if (ret < 0) {
*/
ret = create_thread_poll_set(&events, 2);
if (ret < 0) {
+ goto error_create_poll;
}
/* Add the application registration socket */
}
/* Add the application registration socket */
- 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);
unlink(client_unix_sock_path);
if (client_sock >= 0) {
ret = close(client_sock);
- 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;
rcu_unregister_thread();
return NULL;