Fix: consumer add channel return value was positive on error
[lttng-tools.git] / src / common / consumer.c
index 45eede109bb5cdc5b019e480ea1ed0bae8f1f8b3..96bc337262d65cf525484ac14962f2b44eee19a6 100644 (file)
@@ -890,6 +890,8 @@ end:
 
 /*
  * Add a channel to the global list protected by a mutex.
+ *
+ * On success 0 is returned else a negative value.
  */
 int consumer_add_channel(struct lttng_consumer_channel *channel,
                struct lttng_consumer_local_data *ctx)
@@ -907,7 +909,7 @@ int consumer_add_channel(struct lttng_consumer_channel *channel,
                /* Channel already exist. Ignore the insertion */
                ERR("Consumer add channel key %" PRIu64 " already exists!",
                        channel->key);
-               ret = LTTNG_ERR_KERN_CHAN_EXIST;
+               ret = -EEXIST;
                goto end;
        }
 
@@ -2349,7 +2351,7 @@ void *consumer_thread_data_poll(void *data)
 
                        /* allocate for all fds + 1 for the consumer_data_pipe */
                        local_stream = zmalloc((consumer_data.stream_count + 1) *
-                                       sizeof(struct lttng_consumer_stream));
+                                       sizeof(struct lttng_consumer_stream *));
                        if (local_stream == NULL) {
                                PERROR("local_stream malloc");
                                pthread_mutex_unlock(&consumer_data.lock);
This page took 0.023164 seconds and 4 git commands to generate.