Fix: assign values to path, ctrl and data uris during configuration load
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Thu, 24 Nov 2016 19:33:32 +0000 (14:33 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 25 Nov 2016 22:45:39 +0000 (17:45 -0500)
Since overrides can be partial (name only, etc.) always assign a base
value from the configuration being loaded then apply overrides.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/config/session-config.c

index f8eb37393ff8e73510e401961ab0313c50fab922..b2d7a6b5b149f6f0adb5f6e775d10bb383b901ac 100644 (file)
@@ -1257,24 +1257,28 @@ int create_snapshot_session(const char *session_name, xmlNodePtr output_node,
                        }
                }
 
+               control_uri = output.control_uri;
+               data_uri = output.data_uri;
+               path = output.path;
+
                if (overrides) {
                        if (overrides->path_url) {
-                               /* Control/data_uri are null */
                                path = overrides->path_url;
+                               /* Control/data_uri are null */
+                               control_uri = NULL;
+                               data_uri = NULL;
                        } else {
                                if (overrides->ctrl_url) {
-                                       /* path is null */
                                        control_uri = overrides->ctrl_url;
+                                       /* path is null */
+                                       path = NULL;
                                }
                                if (overrides->data_url) {
-                                       /* path is null */
                                        data_uri = overrides->data_url;
+                                       /* path is null */
+                                       path = NULL;
                                }
                        }
-               } else {
-                       control_uri = output.control_uri;
-                       data_uri = output.data_uri;
-                       path = output.path;
                }
 
                snapshot_output = lttng_snapshot_output_create();
@@ -1372,27 +1376,32 @@ int create_session(const char *name,
                }
        }
 
+       control_uri = output.control_uri;
+       data_uri = output.data_uri;
+       path = output.path;
+
        /* Check for override and apply them */
        if (overrides) {
                if (overrides->path_url) {
-                       /* control/data_uri are null */;
                        path = overrides->path_url;
+                       /* control/data_uri are null */;
+                       control_uri = NULL;
+                       data_uri = NULL;
                } else {
                        if (overrides->ctrl_url) {
-                               /* path is null */
                                control_uri = overrides->ctrl_url;
+                               /* path is null */
+                               path = NULL;
                        }
                        if (overrides->data_url) {
-                               /* path is null */
                                data_uri = overrides->data_url;
+                               /* path is null */
+                               path = NULL;
                        }
                }
-       } else {
-               control_uri = output.control_uri;
-               data_uri = output.data_uri;
-               path = output.path;
        }
 
+
        if (live_timer_interval != UINT64_MAX && !control_uri && !data_uri) {
                ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
                goto end;
This page took 0.027162 seconds and 4 git commands to generate.