accept unnamed sections
authorFelix Fietkau <nbd@openwrt.org>
Wed, 30 Jan 2008 19:16:28 +0000 (20:16 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Wed, 30 Jan 2008 19:16:28 +0000 (20:16 +0100)
file.c

diff --git a/file.c b/file.c
index 980189f..4cb18d2 100644 (file)
--- a/file.c
+++ b/file.c
@@ -244,11 +244,16 @@ static char *next_arg(struct uci_context *ctx, char **str, bool required, bool n
        val = ptr = *str;
        skip_whitespace(ctx, str);
        parse_str(ctx, str, &ptr);
        val = ptr = *str;
        skip_whitespace(ctx, str);
        parse_str(ctx, str, &ptr);
-       if (required && !*val)
-               uci_parse_error(ctx, *str, "insufficient arguments");
+       if (!*val) {
+               if (required)
+                       uci_parse_error(ctx, *str, "insufficient arguments");
+               goto done;
+       }
+
        if (name && !uci_validate_name(val))
                uci_parse_error(ctx, val, "invalid character in field");
 
        if (name && !uci_validate_name(val))
                uci_parse_error(ctx, val, "invalid character in field");
 
+done:
        return val;
 }
 
        return val;
 }