From 18e29540021469e0b0c515b4c3198b7be8fb0072 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Tue, 9 Aug 2016 13:03:00 -0400 Subject: [PATCH] Fix: pass NULL to config_load_session instead of an empty string MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The public lttng_load_session wrapper uses empty strings (strings starting with \0) to express "any" session_name and the default session load paths. However, this is not expected by config_load_session which uses NULLs to express these values. Signed-off-by: Jérémie Galarneau --- src/lib/lttng-ctl/load.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lib/lttng-ctl/load.c b/src/lib/lttng-ctl/load.c index d1faf0269..df712782f 100644 --- a/src/lib/lttng-ctl/load.c +++ b/src/lib/lttng-ctl/load.c @@ -159,14 +159,18 @@ end: int lttng_load_session(struct lttng_load_session_attr *attr) { int ret; + const char *url, *session_name; if (!attr) { ret = -LTTNG_ERR_INVALID; goto end; } - ret = config_load_session(attr->input_url, attr->session_name, - attr->overwrite, 0); + url = attr->input_url[0] != '\0' ? attr->input_url : NULL; + session_name = attr->session_name[0] != '\0' ? + attr->session_name : NULL; + + ret = config_load_session(url, session_name, attr->overwrite, 0); end: return ret; -- 2.34.1