From: David Goulet Date: Mon, 25 Mar 2013 20:30:12 +0000 (-0400) Subject: Fix: lttng create default name check X-Git-Tag: v2.1.2~4 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=12d7ac5a18a321c45480b2df3a1edba603f1cec1;p=lttng-tools.git Fix: lttng create default name check Fixes #449 Signed-off-by: David Goulet --- diff --git a/src/bin/lttng/commands/create.c b/src/bin/lttng/commands/create.c index bf24b6675..6c6566b01 100644 --- a/src/bin/lttng/commands/create.c +++ b/src/bin/lttng/commands/create.c @@ -280,9 +280,16 @@ static int create_session(void) ret = LTTNG_ERR_SESSION_FAIL; goto error; } - if (strncmp(opt_session_name, DEFAULT_SESSION_NAME, + /* + * Check if the session name begins with "auto-" or is exactly "auto". + * Both are reserved for the default session name. See bug #449 to + * understand why we need to check both here. + */ + if ((strncmp(opt_session_name, DEFAULT_SESSION_NAME "-", + strlen(DEFAULT_SESSION_NAME) + 1) == 0) || + (strncmp(opt_session_name, DEFAULT_SESSION_NAME, strlen(DEFAULT_SESSION_NAME)) == 0 && - strlen(opt_session_name) == strlen(DEFAULT_SESSION_NAME)) { + strlen(opt_session_name) == strlen(DEFAULT_SESSION_NAME))) { ERR("%s is a reserved keyword for default session(s)", DEFAULT_SESSION_NAME); ret = CMD_ERROR;