From: David Goulet Date: Wed, 27 Jul 2011 20:26:21 +0000 (-0400) Subject: Fix channel creation when enabling an event X-Git-Tag: v2.0-pre4~1 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=ed8f384d7db2a09cdbd651c0298bfa31992b5a2e;p=lttng-tools.git Fix channel creation when enabling an event If the channel is not found when enabling an event, that channel will be created. Signed-off-by: David Goulet --- diff --git a/ltt-sessiond/main.c b/ltt-sessiond/main.c index bba8aa64d..7603ffd14 100644 --- a/ltt-sessiond/main.c +++ b/ltt-sessiond/main.c @@ -1113,7 +1113,7 @@ static int notify_kernel_pollfd(void) /* * Allocate a channel structure and fill it. */ -static struct lttng_channel *init_default_channel(void) +static struct lttng_channel *init_default_channel(char *name) { struct lttng_channel *chan; @@ -1123,7 +1123,7 @@ static struct lttng_channel *init_default_channel(void) goto error; } - if (snprintf(chan->name, NAME_MAX, DEFAULT_CHANNEL_NAME) < 0) { + if (snprintf(chan->name, NAME_MAX, "%s", name) < 0) { perror("snprintf defautl channel name"); return NULL; } @@ -1526,9 +1526,9 @@ static int process_client_msg(struct command_ctx *cmd_ctx) kchan = get_kernel_channel_by_name(channel_name, cmd_ctx->session->kernel_session); if (kchan == NULL) { - DBG("Creating default channel"); + DBG("Channel not found. Creating channel %s", channel_name); - chan = init_default_channel(); + chan = init_default_channel(channel_name); if (chan == NULL) { ret = LTTCOMM_FATAL; goto error; @@ -1590,9 +1590,9 @@ static int process_client_msg(struct command_ctx *cmd_ctx) kchan = get_kernel_channel_by_name(channel_name, cmd_ctx->session->kernel_session); if (kchan == NULL) { - DBG("Creating default channel"); + DBG("Channel not found. Creating channel %s", channel_name); - chan = init_default_channel(); + chan = init_default_channel(channel_name); if (chan == NULL) { ret = LTTCOMM_FATAL; goto error;