From f2e0110c3bd947e78aa7fe199b2f81794cac50bf Mon Sep 17 00:00:00 2001 From: David Goulet Date: Thu, 28 Jul 2011 12:13:35 -0400 Subject: [PATCH] Fix auto session path duplication Signed-off-by: David Goulet --- lttng/commands/create.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lttng/commands/create.c b/lttng/commands/create.c index b8bbdb7e7..16e3b4d86 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; @@ -125,8 +131,6 @@ 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); } ret = CMD_SUCCESS; -- 2.34.1