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 980189fd1edf7597fa161e3ae2c5603851c07519..4cb18d231fcd3d1d3b743b3b47c28f4f7e184f6d 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);
-       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");
 
+done:
        return val;
 }