X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fuci.git;a=blobdiff_plain;f=list.c;h=67bde395abf3ca3a56b8d725bd4e95f5d74abc3d;hp=02726213deb6977b14c00f3c81f24c395b454a03;hb=c4226c1a45e70346933a1985e159f3eff9d380a5;hpb=b415649d5f68621559b03780c24f03f155796fcb diff --git a/list.c b/list.c index 0272621..67bde39 100644 --- a/list.c +++ b/list.c @@ -341,6 +341,9 @@ 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); @@ -348,6 +351,9 @@ int uci_set_element_value(struct uci_context *ctx, struct uci_element **element, s = uci_to_option(e)->section; section = s->e.name; option = e->name; + /* matches the currently set value */ + if (!strcmp(value, e->name)) + return 0; break; default: UCI_THROW(ctx, UCI_ERR_INVAL); @@ -415,7 +421,7 @@ int uci_add_section(struct uci_context *ctx, struct uci_package *p, const char * return 0; } -int uci_delete(struct uci_context *ctx, struct uci_package *p, char *section, char *option) +int uci_delete(struct uci_context *ctx, struct uci_package *p, const char *section, const char *option) { /* NB: pass on internal flag to uci_del_element */ bool internal = ctx->internal;