X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fuci.git;a=blobdiff_plain;f=list.c;fp=list.c;h=2b859a62c1b7717d0dc3c1502772d97768810218;hp=321861c8eb7d741c17a1cc764e4e648635640b13;hb=df72af474075159ab79ed190d2109eb2d86709bf;hpb=e1bf4356e1b513e158e1b5049147087ed6342cfd diff --git a/list.c b/list.c index 321861c..2b859a6 100644 --- a/list.c +++ b/list.c @@ -150,7 +150,7 @@ __private void uci_fixup_section(struct uci_context *ctx, struct uci_section *s) struct uci_element *e; char buf[16]; - if (!s || s->e.name) + if (!s || !s->anonymous) return; /* @@ -175,7 +175,7 @@ __private void uci_fixup_section(struct uci_context *ctx, struct uci_section *s) break; } } - sprintf(buf, "cfg%02x%04x", ++s->package->n_section, hash % (1 << 16)); + sprintf(buf, "cfg%02x%04x", s->package->name_index, hash % (1 << 16)); s->e.name = uci_strdup(ctx, buf); } @@ -274,7 +274,7 @@ uci_lookup_list(struct uci_list *list, const char *name) struct uci_element *e; uci_foreach_element(list, e) { - if (!strcmp(e->name, name)) + if (e->name && !strcmp(e->name, name)) return e; } return NULL;