From: Jérémie Galarneau Date: Fri, 28 Nov 2014 23:08:30 +0000 (-0500) Subject: Fix: "Any" loglevel's value is -1 and not 0 X-Git-Tag: v2.6.0-rc4~9 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=4b9ac515439490af5e750cd20cdf71bb56061f70;p=lttng-tools.git Fix: "Any" loglevel's value is -1 and not 0 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 --- 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);