consistency
[project/uci.git] / file.c
diff --git a/file.c b/file.c
index d2fdf58..d320ba6 100644 (file)
--- a/file.c
+++ b/file.c
@@ -69,7 +69,7 @@ static void uci_switch_config(struct uci_context *ctx)
         * if an older config under the same name exists, unload it
         * ignore errors here, e.g. if the config was not found
         */
-       e = uci_lookup_list(ctx, &ctx->root, name);
+       e = uci_lookup_list(&ctx->root, name);
        if (e)
                UCI_THROW(ctx, UCI_ERR_DUPLICATE);
        pctx->package = uci_alloc_package(ctx, name);
@@ -122,7 +122,8 @@ static void uci_parse_config(struct uci_context *ctx, char **str)
 
        if (pctx->merge) {
                UCI_TRAP_SAVE(ctx, error);
-               uci_set(ctx, pctx->package, name, NULL, type, NULL);
+               if (uci_set(ctx, pctx->package, name, NULL, type, NULL) != UCI_OK)
+                       goto error;
                UCI_TRAP_RESTORE(ctx);
                return;
 error:
@@ -527,9 +528,8 @@ done:
        return package;
 }
 
-static struct uci_backend uci_file_backend = {
-       .name = "file",
+static UCI_BACKEND(uci_file_backend, "file",
        .load = uci_file_load,
        .commit = uci_file_commit,
        .list_configs = uci_list_config_files,
-};
+);