From: Jonathan Rajotte Date: Thu, 24 Nov 2016 19:33:32 +0000 (-0500) Subject: Fix: assign values to path, ctrl and data uris during configuration load X-Git-Tag: v2.10.0-rc1~98 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=21a3f1441e53c1239d3e8cdd1bf4f08531beb83e;p=lttng-tools.git Fix: assign values to path, ctrl and data uris during configuration load 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 Signed-off-by: Jérémie Galarneau --- diff --git a/src/common/config/session-config.c b/src/common/config/session-config.c index f8eb37393..b2d7a6b5b 100644 --- a/src/common/config/session-config.c +++ b/src/common/config/session-config.c @@ -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;