Fix: Erroneous automatic session name when streaming
authorDavid Goulet <dgoulet@efficios.com>
Mon, 6 May 2013 16:34:57 +0000 (12:34 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Mon, 6 May 2013 16:34:57 +0000 (12:34 -0400)
Fixes #460

Signed-off-by: David Goulet <dgoulet@efficios.com>
src/lib/lttng-ctl/lttng-ctl.c

index 55c0ea19d3a40bfeff226c5037383fc363687713..3787e292e34a5fd7b4fbf018a3f6a68decb90c6b 100644 (file)
@@ -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;
This page took 0.026344 seconds and 4 git commands to generate.