From da4aa2b8074cb59f0740ad204f6eb4e73287a2b6 Mon Sep 17 00:00:00 2001 From: David Goulet Date: Mon, 6 May 2013 12:34:57 -0400 Subject: [PATCH] Fix: Erroneous automatic session name when streaming Fixes #460 Signed-off-by: David Goulet --- src/lib/lttng-ctl/lttng-ctl.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c index 55c0ea19d..3787e292e 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -1642,8 +1642,14 @@ int _lttng_create_session_ext(const char *name, const char *url, lsm.u.uri.size = size; if (size > 0 && uris[0].dtype != LTTNG_DST_PATH && strlen(uris[0].subdir) == 0) { - ret = snprintf(uris[0].subdir, sizeof(uris[0].subdir), "%s-%s", name, - datetime); + /* Don't append datetime if the name was automatically created. */ + if (strncmp(name, DEFAULT_SESSION_NAME "-", + strlen(DEFAULT_SESSION_NAME) + 1)) { + ret = snprintf(uris[0].subdir, sizeof(uris[0].subdir), "%s-%s", + name, datetime); + } else { + ret = snprintf(uris[0].subdir, sizeof(uris[0].subdir), "%s", name); + } if (ret < 0) { PERROR("snprintf uri subdir"); ret = -LTTNG_ERR_FATAL; -- 2.34.1