Browse Source

file: reset parsing position on starting over a newline.

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou 9 years ago
parent
commit
556215152a
1 changed files with 3 additions and 2 deletions
  1. 3 2
      file.c

+ 3 - 2
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);