From 9b7431cfd4e61bc2b1e3bc859d5a6a79de9aa0ed Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Fri, 28 Nov 2014 18:08:30 -0500 Subject: [PATCH] Fix: "Any" loglevel's value is -1 and not 0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit lttng_disable_event_ext() was erroring-out on loglevel != 0. loglevel 0 is a valid level whereas "-1" is used an unknown/unspecified in the rest of the code. Signed-off-by: Jérémie Galarneau --- src/bin/lttng-sessiond/cmd.c | 3 ++- src/bin/lttng/commands/disable_events.c | 3 +++ src/lib/lttng-ctl/lttng-ctl.c | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 33ab492da..696e650de 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -1042,7 +1042,8 @@ int cmd_disable_event(struct ltt_session *session, int domain, event_name = event->name; - if (event->loglevel_type || event->loglevel || event->enabled + /* Error out on unhandled search criteria */ + if (event->loglevel_type || event->loglevel != -1 || event->enabled || event->pid || event->filter || event->exclusion) { return LTTNG_ERR_UNK; } diff --git a/src/bin/lttng/commands/disable_events.c b/src/bin/lttng/commands/disable_events.c index 9ab8bf0b2..45e91a8bb 100644 --- a/src/bin/lttng/commands/disable_events.c +++ b/src/bin/lttng/commands/disable_events.c @@ -222,6 +222,9 @@ static int disable_events(char *session_name) } memset(&event, 0, sizeof(event)); + /* Set default loglevel to any/unknown */ + event.loglevel = -1; + switch (opt_event_type) { case LTTNG_EVENT_SYSCALL: event.type = LTTNG_EVENT_SYSCALL; diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c index 004196965..4a0a07b14 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -1216,6 +1216,7 @@ int lttng_disable_event(struct lttng_handle *handle, const char *name, struct lttng_event ev; memset(&ev, 0, sizeof(ev)); + ev.loglevel = -1; ev.type = LTTNG_EVENT_ALL; lttng_ctl_copy_string(ev.name, name, sizeof(ev.name)); return lttng_disable_event_ext(handle, &ev, channel_name, NULL); -- 2.34.1