From c6934455ec2337e6da7ea9fbc3486ce9beeb5d82 Mon Sep 17 00:00:00 2001 From: OpenEmbedded Date: Wed, 11 Apr 2018 22:51:05 +0200 Subject: [PATCH] x86-linux-setup.c: replace vfscanf() with vsscanf() klibc lacks vfscanf() Upstream-Status: Inappropriate [klibc specific] Signed-off-by: Andrea Adami --- kexec/arch/i386/x86-linux-setup.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) --- a/kexec/arch/i386/x86-linux-setup.c +++ b/kexec/arch/i386/x86-linux-setup.c @@ -215,6 +215,8 @@ static int file_scanf(const char *dir, c FILE *fp; int retno; char filename[PATH_MAX]; + long line_size = MAX_LINE; + char *line; snprintf(filename, PATH_MAX, "%s/%s", dir, file); filename[PATH_MAX-1] = 0; @@ -225,7 +227,14 @@ static int file_scanf(const char *dir, c } va_start(argptr, scanf_line); - retno = vfscanf(fp, scanf_line, argptr); + + line = xmalloc(sizeof(line) * line_size); + while(fgets(line, sizeof(line), fp) != NULL ) { + line_size += MAX_LINE; + line = xrealloc(line,line_size); + } + retno = vsscanf(line, scanf_line, argptr); + va_end(argptr); fclose(fp);