From b0cd9aea98fd7f0d3c901263a2d83dd8a2ca7bd2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Thu, 29 Mar 2018 16:43:14 -0400 Subject: [PATCH] Fix: erroneous use of kernel consumer error codes MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/bin/lttng-sessiond/ust-app.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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, -- 2.34.1