From: David Goulet Date: Mon, 6 May 2013 16:34:57 +0000 (-0400) Subject: Fix: Erroneous automatic session name when streaming X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=commitdiff_plain;h=da4aa2b8074cb59f0740ad204f6eb4e73287a2b6 Fix: Erroneous automatic session name when streaming Fixes #460 Signed-off-by: David Goulet --- 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;