bin: compile lttng-consumerd as a C++
[lttng-tools.git] / src / lib / lttng-ctl / channel.c
index a4e910e1d93db1b02b35f75824ddfb7f714cf5a1..17f9537ba5645690fa2562e8bf5d28f9c9a9d643 100644 (file)
@@ -17,7 +17,6 @@
 #include <common/payload.h>
 #include <common/payload-view.h>
 #include <common/unix.h>
-#include <assert.h>
 #include "lttng-ctl-helper.h"
 #include <common/compat/poll.h>
 
@@ -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);
This page took 0.024269 seconds and 4 git commands to generate.