X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fcreate.c;h=b14b45cd6e1fd31435612590f34e8e07d3f97a28;hb=4b861950d3e6782fbcc6a3f85855d0c1ef58c1f4;hp=b7d9af52ef4e9e51a46a97c9098411a488306f06;hpb=487b253b3ec9f187b4c1b425b246e8e74e5ac309;p=lttng-tools.git diff --git a/src/bin/lttng/commands/create.c b/src/bin/lttng/commands/create.c index b7d9af52e..b14b45cd6 100644 --- a/src/bin/lttng/commands/create.c +++ b/src/bin/lttng/commands/create.c @@ -52,9 +52,9 @@ static struct poptOption long_options[] = { {"help", 'h', POPT_ARG_NONE, NULL, OPT_HELP, NULL, NULL}, {"output", 'o', POPT_ARG_STRING, &opt_output_path, 0, NULL, NULL}, {"list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL}, - {"set-uri", 'U', POPT_ARG_STRING, &opt_url, 0, 0, 0}, - {"ctrl-uri", 'C', POPT_ARG_STRING, &opt_ctrl_url, 0, 0, 0}, - {"data-uri", 'D', POPT_ARG_STRING, &opt_data_url, 0, 0, 0}, + {"set-url", 'U', POPT_ARG_STRING, &opt_url, 0, 0, 0}, + {"ctrl-url", 'C', POPT_ARG_STRING, &opt_ctrl_url, 0, 0, 0}, + {"data-url", 'D', POPT_ARG_STRING, &opt_data_url, 0, 0, 0}, {"no-consumer", 0, POPT_ARG_VAL, &opt_no_consumer, 1, 0, 0}, {"disable-consumer", 0, POPT_ARG_VAL, &opt_disable_consumer, 1, 0, 0}, {0, 0, 0, 0, 0, 0, 0} @@ -209,9 +209,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; @@ -279,6 +286,9 @@ static int create_session(void) case LTTNG_ERR_EXIST_SESS: WARN("Session %s already exists", session_name); break; + default: + ERR("%s", lttng_strerror(ret)); + break; } goto error; }