From: Jérémie Galarneau Date: Mon, 6 Oct 2014 23:47:19 +0000 (-0400) Subject: Fix: Don't save an empty node in kernel channels X-Git-Tag: v2.6.0-rc1~9 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=2aa6405248e70affbc6f131a1e5e77b6141ec2d7;p=lttng-tools.git Fix: Don't save an empty node in kernel channels An empty 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 --- diff --git a/src/bin/lttng-sessiond/save.c b/src/bin/lttng-sessiond/save.c index d268f3319..908e5f8fd 100644 --- a/src/bin/lttng-sessiond/save.c +++ b/src/bin/lttng-sessiond/save.c @@ -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;