From 6a22524d38110480b4748cec843b98b2aff23db7 Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Sun, 25 Feb 2018 20:09:11 +0100 Subject: [PATCH] Fix issue: https://github.com/clicon/clixon/issues/15 Replace whole config --- CHANGELOG.md | 2 +- datastore/text/clixon_xmldb_text.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8f12492..09c863b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,7 @@ enables saved files to be used as datastore without any editing. Thanks Matt. * Added cli_show_version() ### Corrected Bugs - +* Fix issue: https://github.com/clicon/clixon/issues/15 Replace whole config ## 3.5.0 (12 February 2018) diff --git a/datastore/text/clixon_xmldb_text.c b/datastore/text/clixon_xmldb_text.c index 739e2256..776de8d7 100644 --- a/datastore/text/clixon_xmldb_text.c +++ b/datastore/text/clixon_xmldb_text.c @@ -781,6 +781,12 @@ text_modify_top(cxobj *x0, break; } } + /* Special case top-level replace */ + if (op == OP_REPLACE || op == OP_DELETE){ + x0c = NULL; + while ((x0c = xml_child_each(x0, x0c, CX_ELMNT)) != NULL) + xml_purge(x0c); + } /* Loop through children of the modification tree */ x1c = NULL; while ((x1c = xml_child_each(x1, x1c, CX_ELMNT)) != NULL) {