Fix: destroy session removes the default config file
[lttng-tools.git] / src / bin / lttng / utils.c
index ef8d0235a019229cf0c4c1b92c33a58275f8a6de..d52d4622a9c3f3b1dfa34decf94d20bceaa8ecfa 100644 (file)
@@ -40,13 +40,8 @@ static const char *str_jul = "JUL";
 static const char *str_log4j = "LOG4J";
 static const char *str_python = "Python";
 
-/*
- *  get_session_name
- *
- *  Return allocated string with the session name found in the config
- *  directory.
- */
-char *get_session_name(void)
+static
+char *_get_session_name(int quiet)
 {
        char *path, *session_name = NULL;
 
@@ -57,7 +52,8 @@ char *get_session_name(void)
        }
 
        /* Get session name from config */
-       session_name = config_read_session_name(path);
+       session_name = quiet ? config_read_session_name_quiet(path) :
+               config_read_session_name(path);
        if (session_name == NULL) {
                goto error;
        }
@@ -70,6 +66,28 @@ error:
        return NULL;
 }
 
+/*
+ *  get_session_name
+ *
+ *  Return allocated string with the session name found in the config
+ *  directory.
+ */
+char *get_session_name(void)
+{
+       return _get_session_name(0);
+}
+
+/*
+ *  get_session_name_quiet (no warnings/errors emitted)
+ *
+ *  Return allocated string with the session name found in the config
+ *  directory.
+ */
+char *get_session_name_quiet(void)
+{
+       return _get_session_name(1);
+}
+
 /*
  *  list_commands
  *
This page took 0.024516 seconds and 5 git commands to generate.