diff options
author | Felix Fietkau <nbd@openwrt.org> | 2008-02-03 07:37:20 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2008-02-03 07:37:20 +0100 |
commit | cf66ea9067d3e9ffe77f42723c5b2f9d38b05ecf (patch) | |
tree | dd83dd1b8385f7cafb2bcbc980c47cacf728627a | |
parent | 65e2c3559b451315935f9483c5f4e59d63441e54 (diff) | |
download | uci-cf66ea9067d3e9ffe77f42723c5b2f9d38b05ecf.tar.gz |
fix a few bugs found during code reviewv0.1
-rw-r--r-- | history.c | 2 | ||||
-rw-r--r-- | libuci.c | 1 | ||||
-rw-r--r-- | list.c | 6 |
3 files changed, 5 insertions, 4 deletions
@@ -82,7 +82,7 @@ static void uci_parse_history_line(struct uci_context *ctx, struct uci_package * goto error; if (option && !uci_validate_name(option)) goto error; - if ((rename || !delete) && !uci_validate_name(value)) + if ((rename || (!option && !delete)) && !uci_validate_name(value)) goto error; if (rename) @@ -71,6 +71,7 @@ void uci_free_context(struct uci_context *ctx) free(ctx->savedir); UCI_TRAP_SAVE(ctx, ignore); + ctx->internal = true; uci_cleanup(ctx); uci_foreach_element_safe(&ctx->root, tmp, e) { struct uci_package *p = uci_to_package(e); @@ -163,7 +163,7 @@ uci_add_history(struct uci_context *ctx, struct uci_package *p, int cmd, char *s return; if (value) - size += strlen(section) + 1; + size += strlen(value) + 1; h = uci_alloc_element(ctx, history, option, size); ptr = uci_dataptr(h); @@ -446,7 +446,7 @@ int uci_set(struct uci_context *ctx, struct uci_package *p, char *section, char goto notfound; s = uci_to_section(e); - if (ctx->pctx) + if (ctx->pctx && ctx->pctx->merge) ctx->pctx->section = s; if (option) { @@ -485,7 +485,7 @@ notfound: uci_alloc_option(s, option, value); else { s = uci_alloc_section(p, value, section); - if (ctx->pctx) + if (ctx->pctx && ctx->pctx->merge) ctx->pctx->section = s; } |