X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=lttng%2Fcommands%2Fcreate.c;h=4083e4195633a609ceba1ee2c28eb55d3bedff2d;hp=b8bbdb7e7ba453434279a320b538fddb36dd9f9d;hb=5edd7e09e892604b00ca937c0f1bc887bb5a842c;hpb=d6175221183d58027dcac4a6814d2a3457550628 diff --git a/lttng/commands/create.c b/lttng/commands/create.c index b8bbdb7e7..4083e4195 100644 --- a/lttng/commands/create.c +++ b/lttng/commands/create.c @@ -98,8 +98,14 @@ static int create_session() goto error; } - ret = asprintf(&traces_path, "%s/" LTTNG_DEFAULT_TRACE_DIR_NAME - "/%s-%s", alloc_path, session_name, datetime); + if (have_name) { + ret = asprintf(&traces_path, "%s/" LTTNG_DEFAULT_TRACE_DIR_NAME + "/%s-%s", alloc_path, session_name, datetime); + } else { + ret = asprintf(&traces_path, "%s/" LTTNG_DEFAULT_TRACE_DIR_NAME + "/%s", alloc_path, session_name); + } + if (ret < 0) { perror("asprintf trace dir name"); goto error; @@ -123,11 +129,7 @@ static int create_session() } MSG("Session %s created.", session_name); - if (have_name) { - MSG("Traces will be written in %s" , traces_path); - } else { - MSG("Traces will be written in %s/%s", traces_path, session_name); - } + MSG("Traces will be written in %s" , traces_path); ret = CMD_SUCCESS;