From f36463a58671b212f3c56b8976f20da73ed8e311 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Sun, 1 Dec 2024 09:00:26 +0100 Subject: Fixed ignored retvals --- FICS/utils.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'FICS') diff --git a/FICS/utils.c b/FICS/utils.c index e7a926a..9e4ae83 100644 --- a/FICS/utils.c +++ b/FICS/utils.c @@ -494,9 +494,7 @@ pmore_file(int p) fseek(fp, parray[p].last_file_byte, SEEK_SET); while (!feof(fp) && --lcount > 0) { - fgets(tmp, sizeof tmp, fp); - - if (!feof(fp)) + if (fgets(tmp, sizeof tmp, fp) != NULL && !feof(fp)) net_send_string(parray[p].socket, tmp, 1); } @@ -786,9 +784,7 @@ truncate_file(char *file, int lines) return 1; while (!feof(fp)) { - fgets(tBuf[bptr], MAX_LINE_SIZE, fp); - - if (feof(fp)) + if (fgets(tBuf[bptr], MAX_LINE_SIZE, fp) == NULL || feof(fp)) break; if (tBuf[bptr][strlen(tBuf[bptr]) - 1] != '\n') { @@ -835,10 +831,8 @@ lines_file(char *file) if ((fp = fopen(file, "r")) == NULL) return 0; - while (!feof(fp)) { - if (fgets(tmp, sizeof tmp, fp)) - lcount++; - } + while (fgets(tmp, sizeof tmp, fp) != NULL && !feof(fp)) + lcount++; fclose(fp); return lcount; -- cgit v1.2.3