[OpenWrt-Devel] [PATCH 2/2] file: reset parsing position on starting over a newline.

yszhou4tech at gmail.com yszhou4tech at gmail.com
Thu Apr 9 09:48:47 EDT 2015


From: Yousong Zhou <yszhou4tech at gmail.com>


Signed-off-by: Yousong Zhou <yszhou4tech at gmail.com>
---
 file.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/file.c b/file.c
index be75e54..81047a4 100644
--- 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);
-- 
1.7.10.4
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list