delta: fix adding new savedir.
authorYousong Zhou <yszhou4tech@gmail.com>
Wed, 1 Apr 2015 12:44:23 +0000 (20:44 +0800)
committerFelix Fietkau <nbd@openwrt.org>
Fri, 3 Apr 2015 18:42:14 +0000 (20:42 +0200)
Newly added savedir should be at the last position while
uci_add_delta_path() will add it to the position second to the last.

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
delta.c

diff --git a/delta.c b/delta.c
index 357f5c79126064b9d857e612d110680ce91f16c9..459d2c7ddfd5d4443c24c02a76952d40319bb871 100644 (file)
--- 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)