Fix: consumer add channel return value was positive on error
authorDavid Goulet <dgoulet@efficios.com>
Wed, 19 Jun 2013 20:21:41 +0000 (16:21 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Wed, 19 Jun 2013 20:21:41 +0000 (16:21 -0400)
Reported-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/common/consumer.c
src/common/kernel-consumer/kernel-consumer.c

index 6990dd9678ad2723738e3cf5dd18fe2dd53b069f..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;
        }
 
index 39b635dc51bacd9c97b97579cafd833731bfba13..11830fc05a087f4f601a3156560ac5b7a6735365 100644 (file)
@@ -174,7 +174,7 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                }
 
                /* If we received an error in add_channel, we need to report it. */
-               if (ret != 0) {
+               if (ret < 0) {
                        ret = consumer_send_status_msg(sock, ret);
                        if (ret < 0) {
                                goto error_fatal;
This page took 0.028377 seconds and 4 git commands to generate.