Fix: sessiond: kernel: invalid error code check
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 7 Apr 2021 15:55:26 +0000 (11:55 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 7 Apr 2021 15:57:56 +0000 (11:57 -0400)
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 <jeremie.galarneau@efficios.com>
Change-Id: Iae193c9c8d8697af3154a9862bf14d4398c60b60

src/bin/lttng-sessiond/kernel.c

index b431b3dfb6e935ddf068e80e6dd4097d378a0784..c377509ab4205dcba347ac97deec6ce2df478817 100644 (file)
@@ -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;
        }
 
This page took 0.026927 seconds and 4 git commands to generate.