projects
/
project
/
uci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
476db47
)
when running uci set with an empty value, fall back to uci remove
author
Felix Fietkau
<nbd@openwrt.org>
Tue, 18 Aug 2009 19:00:34 +0000
(21:00 +0200)
committer
Felix Fietkau
<nbd@openwrt.org>
Tue, 18 Aug 2009 19:00:34 +0000
(21:00 +0200)
list.c
patch
|
blob
|
history
diff --git
a/list.c
b/list.c
index
adff017
..
352596d
100644
(file)
--- a/
list.c
+++ b/
list.c
@@
-656,7
+656,7
@@
int uci_set(struct uci_context *ctx, struct uci_ptr *ptr)
expand_ptr(ctx, ptr, false);
UCI_ASSERT(ctx, ptr->value);
UCI_ASSERT(ctx, ptr->s || (!ptr->option && ptr->section));
expand_ptr(ctx, ptr, false);
UCI_ASSERT(ctx, ptr->value);
UCI_ASSERT(ctx, ptr->s || (!ptr->option && ptr->section));
- if (!ptr->option) {
+ if (!ptr->option
&& ptr->value[0]
) {
UCI_ASSERT(ctx, uci_validate_type(ptr->value));
}
UCI_ASSERT(ctx, uci_validate_type(ptr->value));
}
@@
-666,7
+666,9
@@
int uci_set(struct uci_context *ctx, struct uci_ptr *ptr)
if (e)
ptr->o = uci_to_option(e);
}
if (e)
ptr->o = uci_to_option(e);
}
- if (!ptr->o && ptr->option) { /* new option */
+ if (!ptr->value[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);
ptr->last = &ptr->o->e;
} else if (!ptr->s && ptr->section) { /* new section */
ptr->o = uci_alloc_option(ptr->s, ptr->option, ptr->value);
ptr->last = &ptr->o->e;
} else if (!ptr->s && ptr->section) { /* new section */