file: add support for setting mode when writing files
[project/rpcd.git] / uci.c
diff --git a/uci.c b/uci.c
index 08489e3..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);
        }
@@ -1442,8 +1442,6 @@ rpc_uci_confirm(struct ubus_context *ctx, struct ubus_object *obj,
        if (!apply_sid[0])
                return UBUS_STATUS_NO_DATA;
 
-       printf("CMP=%s/%s\n", apply_sid, sid);
-
        if (strcmp(apply_sid, sid))
                return UBUS_STATUS_PERMISSION_DENIED;