From 4b9ac515439490af5e750cd20cdf71bb56061f70 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 cc4adfd5d..b54e1d03c 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -1041,7 +1041,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 1ce687aa4..b50882e04 100644 --- a/src/bin/lttng/commands/disable_events.c +++ b/src/bin/lttng/commands/disable_events.c @@ -216,6 +216,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 38cc79f3c..f204055b3 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -1208,6 +1208,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