From a2148b95c49ea2392316b8bd2eb7283e4a4f8f50 Mon Sep 17 00:00:00 2001 From: "Gao,Yan" Date: Sun, 17 May 2015 15:09:47 +0200 Subject: [PATCH] Fix: xml: Correctly create v1 patchsets when deleting attributes --- lib/common/xml.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/common/xml.c b/lib/common/xml.c index e1f90ac6ee5..0db1319e6ea 100644 --- a/lib/common/xml.c +++ b/lib/common/xml.c @@ -4548,6 +4548,8 @@ subtract_xml_object(xmlNode * parent, xmlNode * left, xmlNode * right, /* changes to name/value pairs */ for (xIter = crm_first_attr(left); xIter != NULL; xIter = xIter->next) { const char *prop_name = (const char *)xIter->name; + xmlAttrPtr right_attr = NULL; + xml_private_t *p = NULL; if (strcmp(prop_name, XML_ATTR_ID) == 0) { continue; @@ -4566,8 +4568,13 @@ subtract_xml_object(xmlNode * parent, xmlNode * left, xmlNode * right, continue; } + right_attr = xmlHasProp(right, (const xmlChar *)prop_name); + if (right_attr) { + p = right_attr->_private; + } + right_val = crm_element_value(right, prop_name); - if (right_val == NULL) { + if (right_val == NULL || (p && is_set(p->flags, xpf_deleted))) { /* new */ *changed = TRUE; if (full) {