file: add support for setting mode when writing files
[project/rpcd.git] / uci.c
diff --git a/uci.c b/uci.c
index ef255a8..8b5dafd 100644 (file)
--- a/uci.c
+++ b/uci.c
@@ -1150,7 +1150,10 @@ rpc_uci_revert_commit(struct ubus_context *ctx, struct blob_attr *msg, bool comm
        else
        {
                if (!uci_lookup_ptr(cursor, &ptr, NULL, true) && ptr.p)
+               {
                        uci_revert(cursor, &ptr);
+                       uci_unload(cursor, ptr.p);
+               }
        }
 
        return rpc_uci_status();
@@ -1236,11 +1239,8 @@ static int
 rpc_uci_apply_config(struct ubus_context *ctx, char *config)
 {
        struct uci_package *p = NULL;
-       struct uci_ptr ptr = { 0 };
-
-       ptr.package = config;
 
-       if (!uci_load(cursor, ptr.package, &p)) {
+       if (!uci_load(cursor, config, &p)) {
                uci_commit(cursor, &p, false);
                uci_unload(cursor, p);
        }