Fix: Pass session name to config_load_session when no path is provided
[lttng-tools.git] / src / common / config / config.c
index 088d5b55a1b7e7c926f9ee4c0e1444a41b94ac38..7c6c49b6661a5b7353b0b2aecf67926938a5bdb6 100644 (file)
@@ -31,7 +31,6 @@
 #include <common/error.h>
 #include <common/macros.h>
 #include <common/utils.h>
-#include <common/config/config-session-internal.h>
 #include <lttng/lttng-error.h>
 #include <libxml/parser.h>
 #include <libxml/valid.h>
@@ -1187,9 +1186,6 @@ int create_session(const char *name,
        xmlNodePtr consumer_output_node;
 
        assert(name);
-       assert(kernel_domain);
-       assert(ust_domain);
-       assert(jul_domain);
 
        if (output_node) {
                consumer_output_node = xmlFirstElementChild(output_node);
@@ -2176,7 +2172,7 @@ int process_session_node(xmlNodePtr session_node, const char *session_name,
 
        if (session_name && strcmp(name, session_name)) {
                /* This is not the session we are looking for */
-               ret = -LTTNG_ERR_LOAD_SESSION_NOT_FOUND;
+               ret = -LTTNG_ERR_LOAD_SESSION_NOENT;
                goto end;
        }
 
@@ -2328,7 +2324,7 @@ int load_session_from_file(const char *path, const char *session_name,
 end:
        xmlFreeDoc(doc);
        if (!ret) {
-               ret = session_found ? 0 : -LTTNG_ERR_LOAD_SESSION_NOT_FOUND;
+               ret = session_found ? 0 : -LTTNG_ERR_LOAD_SESSION_NOENT;
        }
        return ret;
 }
@@ -2430,7 +2426,7 @@ end:
        }
 
        if (!session_found) {
-               ret = -LTTNG_ERR_LOAD_SESSION_NOT_FOUND;
+               ret = -LTTNG_ERR_LOAD_SESSION_NOENT;
        }
 
        return ret;
@@ -2460,7 +2456,7 @@ int config_load_session(const char *path, const char *session_name,
                                goto end;
                        }
 
-                       ret = load_session_from_path(path, NULL,
+                       ret = load_session_from_path(path, session_name,
                                &validation_ctx, 0);
                        if (ret && ret != -LTTNG_ERR_LOAD_SESSION_NOENT) {
                                free(path);
@@ -2471,8 +2467,8 @@ int config_load_session(const char *path, const char *session_name,
                }
 
                /* Try system session configuration path */
-               ret = load_session_from_path(DEFAULT_SESSION_SYSTEM_CONFIGPATH, NULL,
-                               &validation_ctx, 0);
+               ret = load_session_from_path(DEFAULT_SESSION_SYSTEM_CONFIGPATH,
+                       session_name, &validation_ctx, 0);
                if (ret && ret != -LTTNG_ERR_LOAD_SESSION_NOENT) {
                        goto end;
                }
This page took 0.026761 seconds and 5 git commands to generate.