X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Fchannel.c;h=17f9537ba5645690fa2562e8bf5d28f9c9a9d643;hb=a0377dfefe40662ba7d68617bce6ff467114136c;hp=a4e910e1d93db1b02b35f75824ddfb7f714cf5a1;hpb=882093eef6fdd658833928a62be5d42fc0cdcb00;p=lttng-tools.git diff --git a/src/lib/lttng-ctl/channel.c b/src/lib/lttng-ctl/channel.c index a4e910e1d..17f9537ba 100644 --- a/src/lib/lttng-ctl/channel.c +++ b/src/lib/lttng-ctl/channel.c @@ -17,7 +17,6 @@ #include #include #include -#include #include "lttng-ctl-helper.h" #include @@ -92,7 +91,7 @@ enum lttng_notification_channel_message_type get_current_message_type( { struct lttng_notification_channel_message *msg; - assert(channel->reception_payload.buffer.size >= sizeof(*msg)); + LTTNG_ASSERT(channel->reception_payload.buffer.size >= sizeof(*msg)); msg = (struct lttng_notification_channel_message *) channel->reception_payload.buffer.data; @@ -164,9 +163,14 @@ struct lttng_notification_channel *lttng_notification_channel_create( } if (is_root || is_in_tracing_group) { - lttng_ctl_copy_string(sock_path, + ret = lttng_strncpy(sock_path, DEFAULT_GLOBAL_NOTIFICATION_CHANNEL_UNIX_SOCK, LTTNG_PATH_MAX); + if (ret) { + ret = -LTTNG_ERR_INVALID; + goto error; + } + ret = lttcomm_connect_unix_sock(sock_path); if (ret >= 0) { fd = ret; @@ -225,7 +229,7 @@ lttng_notification_channel_get_next_notification( if (channel->pending_notifications.count) { struct pending_notification *pending_notification; - assert(!cds_list_empty(&channel->pending_notifications.list)); + LTTNG_ASSERT(!cds_list_empty(&channel->pending_notifications.list)); /* Deliver one of the pending notifications. */ pending_notification = cds_list_first_entry( @@ -628,7 +632,7 @@ enum lttng_notification_channel_status send_condition_command( goto end; } - assert(type == LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_SUBSCRIBE || + LTTNG_ASSERT(type == LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_SUBSCRIBE || type == LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_UNSUBSCRIBE); pthread_mutex_lock(&channel->lock);