From: Jérémie Galarneau Date: Thu, 29 Mar 2018 20:43:14 +0000 (-0400) Subject: Fix: erroneous use of kernel consumer error codes X-Git-Tag: v2.11.0-rc1~315 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=b0cd9aea98fd7f0d3c901263a2d83dd8a2ca7bd2 Fix: erroneous use of kernel consumer error codes Errors related to the kernel consumer are returned in a code path that is only used by the userspace tracer, probably as a result of copy-pasting code. This patch changes the codes to the corresponding CONSUMER32/64 ones and makes them negative to honor the convention indicated in the function's header. Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index 38aeaab60..6828660aa 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -6334,7 +6334,9 @@ int ust_app_rotate_session(struct ltt_session *session, bool *ust_active) reg->registry->reg.ust->metadata_key, LTTNG_DOMAIN_UST, session); if (ret < 0) { - ret = LTTNG_ERR_KERN_CONSUMER_FAIL; + ret = reg->bits_per_long == 32 ? + -LTTNG_ERR_UST_CONSUMER32_FAIL : + -LTTNG_ERR_UST_CONSUMER64_FAIL; goto error; } @@ -6353,7 +6355,9 @@ int ust_app_rotate_session(struct ltt_session *session, bool *ust_active) reg_chan->consumer_key, LTTNG_DOMAIN_UST, session); if (ret < 0) { - ret = LTTNG_ERR_KERN_CONSUMER_FAIL; + ret = reg->bits_per_long == 32 ? + -LTTNG_ERR_UST_CONSUMER32_FAIL : + -LTTNG_ERR_UST_CONSUMER64_FAIL; goto error; } ret = consumer_rotate_channel(socket, @@ -6430,7 +6434,9 @@ int ust_app_rotate_session(struct ltt_session *session, bool *ust_active) ret = rotate_add_channel_pending(registry->metadata_key, LTTNG_DOMAIN_UST, session); if (ret < 0) { - ret = LTTNG_ERR_KERN_CONSUMER_FAIL; + ret = app->bits_per_long == 32 ? + -LTTNG_ERR_UST_CONSUMER32_FAIL : + -LTTNG_ERR_UST_CONSUMER64_FAIL; goto error; } @@ -6441,7 +6447,9 @@ int ust_app_rotate_session(struct ltt_session *session, bool *ust_active) ua_chan->key, LTTNG_DOMAIN_UST, session); if (ret < 0) { - ret = LTTNG_ERR_KERN_CONSUMER_FAIL; + ret = app->bits_per_long == 32 ? + -LTTNG_ERR_UST_CONSUMER32_FAIL : + -LTTNG_ERR_UST_CONSUMER64_FAIL; goto error; } ret = consumer_rotate_channel(socket, ua_chan->key,