Fix error handling for config_document/element
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Mon, 27 Jun 2016 19:10:09 +0000 (15:10 -0400)
committerJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Mon, 11 Jul 2016 15:20:33 +0000 (11:20 -0400)
src/common/config/session-config.c

index 1c8a1e3ed5ffce1383b90c64c3f115151ce42415..7ce2b0130289375ed5438b3541cf6fc34e100d1f 100644 (file)
@@ -3424,7 +3424,7 @@ int config_document_replace_element(struct config_document *document,
        }
 
        if (xpath_result_size == 0) {
-               ret = -LTTNG_ERR_CONFIG_REPLACEMENT;
+               ret = -LTTNG_ERR_CONFIG_INVALID_COUNT;
                goto end;
        }
 
@@ -3434,7 +3434,6 @@ int config_document_replace_element(struct config_document *document,
        copy = xmlCopyNode(element->element, 1);
        if (!copy) {
                ret = -LTTNG_ERR_NOMEM;
-               ERR("Copy failed for node replacement");
                goto end;
        }
 
@@ -3732,7 +3731,6 @@ int config_document_insert_element(struct config_document *document,
        local_copy = xmlCopyNode(element->element, 1);
        if (!local_copy) {
                ret = -LTTNG_ERR_NOMEM;
-               ERR("Duplication of node to be insert failed");
                goto end;
        }
 
@@ -4022,13 +4020,14 @@ int config_element_add_or_replace_child(struct config_element *parent, struct co
        /* Add the child */
        local_copy = xmlCopyNode(x_child, 1);
        if (!local_copy) {
-               ret = -1;
                ERR("Duplication of node to be insert failed");
+               ret = -LTTNG_ERR_CONFIG_ADD_CHILD;
                goto end;
        }
        x_ret = xmlAddChild(x_parent, local_copy);
        if (!x_ret) {
                xmlFreeNode(local_copy);
+               ret = -LTTNG_ERR_CONFIG_ADD_CHILD;
        }
 end:
        return ret;
@@ -4178,8 +4177,7 @@ int config_process_event_element(const struct config_element *element, const cha
 
        handle = lttng_create_handle(session_name, &domain);
        if (!handle) {
-               ERR("Handle creation");
-               ret = 1;
+               ret = -LTTNG_ERR_HANDLE_CREATION;
                goto error;
        }
 
@@ -4187,8 +4185,7 @@ int config_process_event_element(const struct config_element *element, const cha
        node = element->element;
        /* Check if element is really and event */
        if (xmlStrcmp(BAD_CAST config_element_event, node->name)) {
-               ERR("Passed element is not an event");
-               ret = 1;
+               ret = -LTTNG_ERR_CONFIG_INVALID_ELEMENT;
                goto error;
        }
 
This page took 0.034086 seconds and 5 git commands to generate.