From e8ed491ba9f2fe6df8f071e7c59e0174bb307a1b Mon Sep 17 00:00:00 2001 From: Bert Date: Tue, 15 Feb 2011 15:30:37 +0100 Subject: Fixed empty lines in readline() --- util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'util.c') diff --git a/util.c b/util.c index 82ab057..5c5737b 100644 --- a/util.c +++ b/util.c @@ -102,11 +102,11 @@ char* readline(FILE *stream) { } } while (!end && !feof(stream) && !ferror(stream)); - if (!ferror(stream) && *buf) { + if (ferror(stream)) { + s = NULL; + } else { s = (char*) s_malloc((strlen(buf) + 1) * sizeof(char)); strcpy(s, buf); - } else { - s = NULL; } free(buf); -- cgit v1.2.3-54-g00ecf