From 0eb31f91eea93d9cf4fe5cbe56904313c379e88b Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Thu, 23 Apr 2015 21:59:02 +0200 Subject: [PATCH] fileio: Skip the whole line after a non quoted comment --- fileio.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fileio.c b/fileio.c index 1ef1978..c10a6d6 100644 --- a/fileio.c +++ b/fileio.c @@ -36,9 +36,14 @@ pkg_fgetline(char *line, size_t size, FILE *stream) } else if (c == '#') { - if (!quoted) + if (!quoted) { + /* Skip the rest of the line */ + do { + c = getc(stream); + } while (c != '\n' && c != EOF); + *s++ = c; break; - + } quoted = false; continue; }