diff options
author | Felix Fietkau <nbd@openwrt.org> | 2008-08-18 22:14:14 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2008-08-18 22:14:14 +0200 |
commit | 28d2cc2adde3f9ec077a77cf363045a17f116032 (patch) | |
tree | 4a21fb57b87c76705586c6d29ee91c51326b9536 | |
parent | 236f7468c5eb30f1381a7059cf780b7fe173ec48 (diff) | |
download | uci-28d2cc2adde3f9ec077a77cf363045a17f116032.tar.gz |
fix list parsing with anonymous sections
-rw-r--r-- | file.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -187,8 +187,20 @@ static void uci_parse_list(struct uci_context *ctx, char **str) return; error: UCI_THROW(ctx, ctx->err); - } else - UCI_INTERNAL(uci_add_list, ctx, pctx->package, pctx->section->e.name, name, value, NULL); + } else { + struct uci_option *o; + struct uci_element *e; + + e = uci_lookup_list(&pctx->section->options, name); + o = uci_to_option(e); + if (!o) { + o = uci_alloc_list(pctx->section, name); + } else { + if (o->type != UCI_TYPE_LIST) + uci_parse_error(ctx, *str, "conflicting list/option keywords"); + } + UCI_INTERNAL(uci_add_element_list, ctx, o, value); + } } |