Fix: Don't append datetime to default session name
authorDavid Goulet <dgoulet@efficios.com>
Fri, 2 Nov 2012 18:14:26 +0000 (14:14 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Fri, 2 Nov 2012 18:14:31 +0000 (14:14 -0400)
The liblttng-ctl was appending the date and time to the "auto" session
if detected. The 'auto' keyword is only used by lttng command line

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

index 2c58075b4646cde144763ae30542608fa698eb4e..08b12a46eee2b95e6093f738a97a5b0f01936551 100644 (file)
@@ -271,11 +271,7 @@ static int create_session(void)
                        PERROR("snprintf session name");
                        goto error;
                }
-               session_name = strdup(DEFAULT_SESSION_NAME);
-               if (session_name == NULL) {
-                       PERROR("strdup session name");
-                       goto error;
-               }
+               session_name = session_name_date;
                DBG("Auto session name set to %s", session_name_date);
        } else {
                if (strncmp(opt_session_name, DEFAULT_SESSION_NAME,
@@ -353,11 +349,7 @@ static int create_session(void)
                goto error;
        }
 
-       if (opt_session_name == NULL) {
-               MSG("Session %s created.", session_name_date);
-       } else {
-               MSG("Session %s created.", session_name);
-       }
+       MSG("Session %s created.", session_name);
        MSG("Traces will be written in %s", print_str_url);
 
        if (opt_ctrl_url || opt_data_url) {
@@ -380,11 +372,6 @@ static int create_session(void)
                }
        }
 
-       if (opt_session_name == NULL) {
-               free(session_name);
-               session_name = session_name_date;
-       }
-
        /* Init lttng session config */
        ret = config_init(session_name);
        if (ret < 0) {
@@ -396,10 +383,6 @@ static int create_session(void)
        ret = CMD_SUCCESS;
 
 error:
-       if (opt_session_name == NULL && session_name != session_name_date) {
-               free(session_name);
-       }
-
        if (alloc_url) {
                free(alloc_url);
        }
index bbe7cb4180dda914676714496fe31c56d09bf56e..46338fb8520bb076737e79782048e0e9e8aa042f 100644 (file)
@@ -1606,17 +1606,7 @@ int _lttng_create_session_ext(const char *name, const char *url,
        memset(&lsm, 0, sizeof(lsm));
 
        lsm.cmd_type = LTTNG_CREATE_SESSION;
-       if (!strncmp(name, DEFAULT_SESSION_NAME, strlen(DEFAULT_SESSION_NAME))
-                       && strlen(name) == strlen(DEFAULT_SESSION_NAME)) {
-               ret = snprintf(lsm.session.name, sizeof(lsm.session.name), "%s-%s",
-                               name, datetime);
-               if (ret < 0) {
-                       PERROR("snprintf session name datetime");
-                       return -LTTNG_ERR_FATAL;
-               }
-       } else {
-               copy_string(lsm.session.name, name, sizeof(lsm.session.name));
-       }
+       copy_string(lsm.session.name, name, sizeof(lsm.session.name));
 
        /* There should never be a data URL */
        size = parse_str_urls_to_uri(url, NULL, &uris);
This page took 0.029176 seconds and 5 git commands to generate.