From: Jérémie Galarneau Date: Wed, 7 Apr 2021 15:55:26 +0000 (-0400) Subject: Fix: sessiond: kernel: invalid error code check X-Git-Tag: v2.13.0-rc1~159 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=d79bd829001f60a92c9c88c857635b8543ccf7ef;p=lttng-tools.git Fix: sessiond: kernel: invalid error code check The `EEXIST` error code does not make sense for a kernctl_disable() operation. In fact, not existing would be an error. Signed-off-by: Jérémie Galarneau Change-Id: Iae193c9c8d8697af3154a9862bf14d4398c60b60 --- diff --git a/src/bin/lttng-sessiond/kernel.c b/src/bin/lttng-sessiond/kernel.c index b431b3dfb..c377509ab 100644 --- a/src/bin/lttng-sessiond/kernel.c +++ b/src/bin/lttng-sessiond/kernel.c @@ -769,14 +769,8 @@ int kernel_disable_event(struct ltt_kernel_event *event) ret = kernctl_disable(event->fd); if (ret < 0) { - switch (-ret) { - case EEXIST: - ret = LTTNG_ERR_KERN_EVENT_EXIST; - break; - default: - PERROR("disable kernel event"); - break; - } + PERROR("Failed to disable kernel event: name = '%s', fd = %d", + event->event->name, event->fd); goto error; } @@ -805,15 +799,8 @@ int kernel_disable_event_notifier_rule(struct ltt_kernel_event_notifier_rule *ev ret = kernctl_disable(event->fd); if (ret < 0) { - switch (-ret) { - case EEXIST: - ret = LTTNG_ERR_KERN_EVENT_EXIST; - break; - default: - PERROR("Failed to disable kernel event notifier: fd = %d, token = %" PRIu64, - event->fd, event->token); - break; - } + PERROR("Failed to disable kernel event notifier: fd = %d, token = %" PRIu64, + event->fd, event->token); goto error; }