From 442f9815fa99344367af117cba29f2c0e209a0cf Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 16 Feb 2009 23:05:31 +0100 Subject: [PATCH] Dont assume error if fgets returns NULL --- client/client.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/client/client.c b/client/client.c index 5126d97..93741ca 100644 --- a/client/client.c +++ b/client/client.c @@ -3547,16 +3547,12 @@ int cmd_source(const char* arg, int echo ) return -1; } - while (!feof(includeFile)) { - memset(line, 0, sizeof(line)); - if (!fgets(line, sizeof(line), includeFile)) - { - perror("fgets"); - break; - } - - if (strlen(line) < 2) continue; - if (line[0] == '#') continue; + while (fgets(line, sizeof(line), includeFile)) + { + if (strlen(line) < 2) + continue; + if (line[0] == '#') + continue; if ((cp = strrchr(line, '\n'))) *cp = '\0'; -- 1.7.10.4