file: reset parsing position on starting over a newline.
authorYousong Zhou <yszhou4tech@gmail.com>
Thu, 9 Apr 2015 13:48:47 +0000 (21:48 +0800)
committerFelix Fietkau <nbd@openwrt.org>
Thu, 9 Apr 2015 14:55:17 +0000 (16:55 +0200)
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
file.c

diff --git a/file.c b/file.c
index be75e54b230b8153e0cfaa1c9fa4e0a4a00987e6..81047a48352ddbb836d55c7a01611fd2cd5adce5 100644 (file)
--- a/file.c
+++ b/file.c
@@ -278,10 +278,11 @@ int uci_parse_argument(struct uci_context *ctx, FILE *stream, char **str, char *
                uci_alloc_parse_context(ctx);
 
        ctx->pctx->file = stream;
-       if (!*str)
+       if (!*str) {
+               ctx->pctx->pos = 0;
                uci_getln(ctx, 0);
+       }
 
-       /*FIXME do we need to skip empty lines? */
        ofs_result = next_arg(ctx, false, false, false);
        *result = pctx_str(ctx->pctx, ofs_result);
        *str = pctx_cur_str(ctx->pctx);