From: Jérémie Galarneau Date: Tue, 9 Aug 2016 17:03:00 +0000 (-0400) Subject: Fix: pass NULL to config_load_session instead of an empty string X-Git-Tag: v2.7.5~17 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=c5c3a40358036c7f8868b961c0e4c56b80c814bc;p=lttng-tools.git Fix: pass NULL to config_load_session instead of an empty string 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 --- diff --git a/src/lib/lttng-ctl/load.c b/src/lib/lttng-ctl/load.c index 3599503e5..39003e947 100644 --- a/src/lib/lttng-ctl/load.c +++ b/src/lib/lttng-ctl/load.c @@ -160,14 +160,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;