Fix: Don't save an empty <contexts> node in kernel channels
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 6 Oct 2014 23:47:19 +0000 (19:47 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Tue, 7 Oct 2014 20:46:28 +0000 (16:46 -0400)
An empty <contexts/> node is saved when kernel channels are
saved even when no kernel contexts are enabled.

Note that this is a minor fix as the generated XML remains valid
anyhow.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/save.c

index d268f33190698d6f9bd920a5bbdbab140a377d70..908e5f8fd2924d67223ffbdcbf8a04dfc158a502 100644 (file)
@@ -801,6 +801,11 @@ int save_kernel_contexts(struct config_writer *writer,
        int ret;
        struct ltt_kernel_context *ctx;
 
+       if (cds_list_empty(&kchan->ctx_list)) {
+               ret = 0;
+               goto end;
+       }
+
        ret = config_writer_open_element(writer, config_element_contexts);
        if (ret) {
                ret = LTTNG_ERR_SAVE_IO_FAIL;
This page took 0.028895 seconds and 4 git commands to generate.