Fix: pass NULL to config_load_session instead of an empty string
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 9 Aug 2016 17:03:00 +0000 (13:03 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 9 Aug 2016 17:08:13 +0000 (13:08 -0400)
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 <jeremie.galarneau@efficios.com>
src/lib/lttng-ctl/load.c

index 3599503e51ad5b08eba677a01b213a107bad7ad1..39003e9479776104519f2fff6771b6827259069c 100644 (file)
@@ -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;
This page took 0.026036 seconds and 4 git commands to generate.