From: David Goulet Date: Wed, 21 May 2014 16:09:15 +0000 (-0400) Subject: Fix: disable-event/channel return error if no domain X-Git-Tag: v2.5.0-rc1~33 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=5f3ecf227733fc0db1469c9d7e40c6d2e18715f8;p=lttng-tools.git Fix: disable-event/channel return error if no domain The disable-event/channel command now check for a UST/kernel session before trying to disable the object. If none exists, it returns an error without creating a domain. Fixes #638 Signed-off-by: David Goulet --- diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 5448259e5..1d218b170 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -2822,6 +2822,38 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int sock, break; } + /* + * Commands that need a valid session but should NOT create one if none + * exists. Instead of creating one and destroying it when the command is + * handled, process that right before so we save some round trip in useless + * code path. + */ + switch (cmd_ctx->lsm->cmd_type) { + case LTTNG_DISABLE_CHANNEL: + case LTTNG_DISABLE_EVENT: + case LTTNG_DISABLE_ALL_EVENT: + switch (cmd_ctx->lsm->domain.type) { + case LTTNG_DOMAIN_KERNEL: + if (!cmd_ctx->session->kernel_session) { + ret = LTTNG_ERR_NO_CHANNEL; + goto error; + } + break; + case LTTNG_DOMAIN_JUL: + case LTTNG_DOMAIN_UST: + if (!cmd_ctx->session->ust_session) { + ret = LTTNG_ERR_NO_CHANNEL; + goto error; + } + break; + default: + ret = LTTNG_ERR_UNKNOWN_DOMAIN; + goto error; + } + default: + break; + } + if (!need_domain) { goto skip_domain; }