This is a reserved keyword for default session(s). Note that this is
only for the lttng command line tool. Using 'auto' is possible with the
API but the current date and time is automatically appended to it for
now so be aware of that.
Fixes #359
Signed-off-by: David Goulet <dgoulet@efficios.com>
}
DBG("Auto session name set to %s", session_name_date);
} else {
+ if (strncmp(opt_session_name, DEFAULT_SESSION_NAME,
+ strlen(DEFAULT_SESSION_NAME)) == 0 &&
+ strlen(opt_session_name) == strlen(DEFAULT_SESSION_NAME)) {
+ ERR("%s is a reserved keyword for default session(s)",
+ DEFAULT_SESSION_NAME);
+ ret = CMD_ERROR;
+ goto error;
+ }
session_name = opt_session_name;
ret = snprintf(session_name_date, sizeof(session_name_date),
"%s-%s", session_name, datetime);
memset(&lsm, 0, sizeof(lsm));
lsm.cmd_type = LTTNG_CREATE_SESSION;
- if (!strncmp(name, DEFAULT_SESSION_NAME, strlen(DEFAULT_SESSION_NAME))) {
+ if (!strncmp(name, DEFAULT_SESSION_NAME, strlen(DEFAULT_SESSION_NAME))
+ && strlen(name) == strlen(DEFAULT_SESSION_NAME)) {
ret = snprintf(lsm.session.name, sizeof(lsm.session.name), "%s-%s",
name, datetime);
if (ret < 0) {