Skip to content

Commit

Permalink
Merge pull request #715 from gao-yan/patchset-v1-delete-attribute
Browse files Browse the repository at this point in the history
Fix: xml: Correctly create v1 patchsets when deleting attributes
  • Loading branch information
beekhof committed May 18, 2015
2 parents 0b79da3 + a2148b9 commit 2135206
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/common/xml.c
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down

0 comments on commit 2135206

Please sign in to comment.