From ca53e097c3b406d612b94422122043c193eb2ca5 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Mon, 26 Oct 2015 00:16:28 +0100 Subject: [PATCH] lfile: Initialize strtok_r() save pointer Must initialize the save pointer in the parser context, otherwise strtok_r() will fail on statically built embedded targets. Signed-off-by: Joachim Nilsson --- lfile.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lfile.c b/lfile.c index b986d3d..df97503 100644 --- a/lfile.c +++ b/lfile.c @@ -47,8 +47,9 @@ lfile_t *lfopen(char *file, char *sep) /* Use calloc for clearing buf on behalf of lftok() */ lf = calloc(sizeof(*lf), sizeof(char)); if (lf) { - lf->fp = fopen(file, "r"); - lf->sep = sep; + lf->fp = fopen(file, "r"); + lf->sep = sep; + lf->save = lf->buf; if (!lf->fp) { free(lf);