summaryrefslogtreecommitdiffstats
path: root/lib/cib/cib_attrs.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/cib/cib_attrs.c')
-rw-r--r--lib/cib/cib_attrs.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/cib/cib_attrs.c b/lib/cib/cib_attrs.c
index 5f3a722..11629b8 100644
--- a/lib/cib/cib_attrs.c
+++ b/lib/cib/cib_attrs.c
@@ -152,16 +152,15 @@ find_attr(cib_t *cib, const char *section, const char *node_uuid,
static int
handle_multiples(pcmk__output_t *out, xmlNode *search, const char *attr_name)
{
- if (xml_has_children(search)) {
+ if ((search != NULL) && (search->children != NULL)) {
xmlNode *child = NULL;
- out->info(out, "Multiple attributes match name=%s", attr_name);
+ out->info(out, "Multiple attributes match name=%s", attr_name);
for (child = pcmk__xml_first_child(search); child != NULL;
child = pcmk__xml_next(child)) {
out->info(out, " Value: %s \t(id=%s)",
crm_element_value(child, XML_NVPAIR_ATTR_VALUE), ID(child));
}
-
return ENOTUNIQ;
} else {
@@ -184,9 +183,9 @@ cib__update_node_attr(pcmk__output_t *out, cib_t *cib, int call_options, const c
char *local_attr_id = NULL;
char *local_set_name = NULL;
- CRM_CHECK(section != NULL, return EINVAL);
- CRM_CHECK(attr_value != NULL, return EINVAL);
- CRM_CHECK(attr_name != NULL || attr_id != NULL, return EINVAL);
+ CRM_CHECK((out != NULL) && (cib != NULL) && (section != NULL)
+ && ((attr_id != NULL) || (attr_name != NULL))
+ && (attr_value != NULL), return EINVAL);
rc = find_attr(cib, section, node_uuid, set_type, set_name, attr_id,
attr_name, user_name, &xml_search);
@@ -360,7 +359,7 @@ cib__get_node_attrs(pcmk__output_t *out, cib_t *cib, const char *section,
crm_trace("Query failed for attribute %s (section=%s node=%s set=%s): %s",
pcmk__s(attr_name, "with unspecified name"),
section, pcmk__s(set_name, "<null>"),
- pcmk__s(node_uuid, "<null>"), pcmk_strerror(rc));
+ pcmk__s(node_uuid, "<null>"), pcmk_rc_str(rc));
}
return rc;
@@ -487,7 +486,7 @@ read_attr_delegate(cib_t *cib, const char *section, const char *node_uuid,
attr_id, attr_name, user_name, &result);
if (rc == pcmk_rc_ok) {
- if (!xml_has_children(result)) {
+ if (result->children == NULL) {
pcmk__str_update(attr_value, crm_element_value(result, XML_NVPAIR_ATTR_VALUE));
} else {
rc = ENOTUNIQ;
@@ -677,9 +676,7 @@ query_node_uname(cib_t * the_cib, const char *uuid, char **uname)
}
xml_obj = fragment;
- CRM_CHECK(pcmk__str_eq(crm_element_name(xml_obj), XML_CIB_TAG_NODES, pcmk__str_casei),
- return -ENOMSG);
- CRM_ASSERT(xml_obj != NULL);
+ CRM_CHECK(pcmk__xe_is(xml_obj, XML_CIB_TAG_NODES), return -ENOMSG);
crm_log_xml_trace(xml_obj, "Result section");
rc = -ENXIO;