Fix: Succesful session load might still report an error
[lttng-tools.git] / src / common / config / config.c
index a890c9d872e1778875811c598cd448451a5ff793..e74e20f6c016e2fbbfe101c19a52fa0f6de93e18 100644 (file)
@@ -1186,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);
@@ -2459,9 +2456,10 @@ 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) {
+                       if (!ret || (ret && ret != -LTTNG_ERR_LOAD_SESSION_NOENT)) {
+                               /* Session found or an error occured */
                                free(path);
                                goto end;
                        }
@@ -2470,9 +2468,10 @@ 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);
-               if (ret && ret != -LTTNG_ERR_LOAD_SESSION_NOENT) {
+               ret = load_session_from_path(DEFAULT_SESSION_SYSTEM_CONFIGPATH,
+                       session_name, &validation_ctx, 0);
+               if (!ret || (ret && ret != -LTTNG_ERR_LOAD_SESSION_NOENT)) {
+                       /* Session found or an error occured */
                        goto end;
                }
        } else {
This page took 0.02479 seconds and 5 git commands to generate.