]> pilppa.org Git - uci.git/blobdiff - file.c
cleanup
[uci.git] / file.c
diff --git a/file.c b/file.c
index 412ce138680e0bf56d423e6845eb839229c93bed..9a2e353fe92e77a65893d3536e6c52eab623ca14 100644 (file)
--- a/file.c
+++ b/file.c
@@ -293,14 +293,9 @@ 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
         */
-       UCI_TRAP_SAVE(ctx, ignore);
        e = uci_lookup_list(ctx, &ctx->root, name);
        if (e)
-               uci_unload(ctx, uci_to_package(e));
-       UCI_TRAP_RESTORE(ctx);
-ignore:
-       ctx->errno = 0;
-
+               UCI_THROW(ctx, UCI_ERR_DUPLICATE);
        pctx->package = uci_alloc_package(ctx, name);
 }