X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fuci.git;a=blobdiff_plain;f=list.c;h=b20ee712308ecdcc26db0caae67e264b2177e2f3;hp=99b3ab95592d3eec1011fb3fade22eaeab5f3e95;hb=a4c7003b70fd3dc68cde5250ed74ee457bcecfe1;hpb=057e46181b7ea2c322657d838225d9f4e374cb3c diff --git a/list.c b/list.c index 99b3ab9..b20ee71 100644 --- a/list.c +++ b/list.c @@ -315,6 +315,7 @@ int uci_set_element_value(struct uci_context *ctx, struct uci_element **element, struct uci_element *e; struct uci_package *p; struct uci_section *s; + struct uci_option *o; char *section; char *option; char *str; @@ -341,13 +342,20 @@ int uci_set_element_value(struct uci_context *ctx, struct uci_element **element, s = uci_to_section(e); section = e->name; option = NULL; + /* matches the currently set value */ + if (!strcmp(value, s->type)) + return 0; break; case UCI_TYPE_OPTION: UCI_ASSERT(ctx, value != NULL); size = sizeof(struct uci_option); - s = uci_to_option(e)->section; + o = uci_to_option(e); + s = o->section; section = s->e.name; - option = e->name; + option = o->e.name; + /* matches the currently set value */ + if (!strcmp(value, o->value)) + return 0; break; default: UCI_THROW(ctx, UCI_ERR_INVAL);