diff options
author | Felix Fietkau <nbd@openwrt.org> | 2009-08-18 21:04:40 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2009-08-18 21:04:40 +0200 |
commit | 2ae9f4d72d7907e8edda7d361a0eb84a86f1bab3 (patch) | |
tree | 999a67f94b94232749b59f1a67152d63370bfdf2 /list.c | |
parent | 83300a90f50a2af5592edbfb2952ac4009041d20 (diff) | |
download | uci-2ae9f4d72d7907e8edda7d361a0eb84a86f1bab3.tar.gz |
do not fail when attempting to set a nonexistant option to an empty value
Diffstat (limited to 'list.c')
-rw-r--r-- | list.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -667,6 +667,11 @@ int uci_set(struct uci_context *ctx, struct uci_ptr *ptr) ptr->o = uci_to_option(e); } if (!ptr->value[0]) { + /* if setting a nonexistant option/section to a nonexistant value, + * exit without errors */ + if (!(ptr->flags & UCI_LOOKUP_COMPLETE)) + return 0; + return uci_delete(ctx, ptr); } else if (!ptr->o && ptr->option) { /* new option */ ptr->o = uci_alloc_option(ptr->s, ptr->option, ptr->value); |