X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fuci.git;a=blobdiff_plain;f=delta.c;h=e9c79ab5be07b80058869b8a4ba69c04cee3de44;hp=357f5c79126064b9d857e612d110680ce91f16c9;hb=021fd65643a7932dc67ebeb2291264e308432428;hpb=3c7f3556b0039a19ddd3e263286085f6896da0eb diff --git a/delta.c b/delta.c index 357f5c7..e9c79ab 100644 --- a/delta.c +++ b/delta.c @@ -114,9 +114,8 @@ int uci_set_savedir(struct uci_context *ctx, const char *dir) } } if (!exists) - UCI_INTERNAL(uci_add_delta_path, ctx, dir); - else - uci_list_add(&ctx->delta_path, &e->list); + e = uci_alloc_generic(ctx, UCI_TYPE_PATH, dir, sizeof(struct uci_element)); + uci_list_add(&ctx->delta_path, &e->list); sdir = uci_strdup(ctx, dir); if (ctx->savedir != uci_savedir) @@ -294,13 +293,15 @@ static int uci_load_delta_file(struct uci_context *ctx, struct uci_package *p, c UCI_TRAP_SAVE(ctx, done); stream = uci_open_stream(ctx, filename, NULL, SEEK_SET, flush, false); + UCI_TRAP_RESTORE(ctx); + if (p) changes = uci_parse_delta(ctx, stream, p); - UCI_TRAP_RESTORE(ctx); + done: if (f) *f = stream; - else if (stream) + else uci_close_stream(stream); return changes; }