diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-12-01 09:00:26 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-12-01 09:00:26 +0100 |
commit | f36463a58671b212f3c56b8976f20da73ed8e311 (patch) | |
tree | 14c58feb7c30a7c3338efe0452dd5a58891ae893 /FICS | |
parent | 3549f0a8e16a895baa1f8763129982b156b9dc99 (diff) |
Fixed ignored retvals
Diffstat (limited to 'FICS')
-rw-r--r-- | FICS/utils.c | 14 |
1 files changed, 4 insertions, 10 deletions
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; |