summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2008-02-05 21:25:00 +0100
committerFelix Fietkau <nbd@openwrt.org>2008-02-05 21:25:00 +0100
commit12bdbcd95d42509f3b9f06bc7e811c1781635417 (patch)
tree7a49998e039f7f8e88d1ab180427b2c658a14350 /util.c
parenta428a41ac99c2673409fc15dbbe6a4c8d897c7b6 (diff)
downloaduci-12bdbcd95d42509f3b9f06bc7e811c1781635417.tar.gz
fix uci_parse_tuplev0.2.4
Diffstat (limited to 'util.c')
-rw-r--r--util.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/util.c b/util.c
index bc137c3..1d71335 100644
--- a/util.c
+++ b/util.c
@@ -97,30 +97,29 @@ int uci_parse_tuple(struct uci_context *ctx, char *str, char **package, char **s
UCI_HANDLE_ERR(ctx);
UCI_ASSERT(ctx, str && package && section && option);
+ last = strchr(str, '=');
+ if (last) {
+ *last = 0;
+ last++;
+ }
+
*package = strtok(str, ".");
if (!*package || !uci_validate_name(*package))
goto error;
- last = *package;
*section = strtok(NULL, ".");
if (!*section)
goto lastval;
- last = *section;
*option = strtok(NULL, ".");
if (!*option)
goto lastval;
- last = *option;
-
lastval:
- last = strchr(last, '=');
if (last) {
if (!value)
goto error;
- *last = 0;
- last++;
if (!*last)
goto error;
*value = last;