aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-11-26 23:46:30 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2024-11-26 23:46:30 +0100
commit56936d1c33d661e7ac6db4b68342bb26ea5534e1 (patch)
tree45243ce95ea34a19094a68f2ee2f19dfb62ec249
parentcf861ae13a04a5c94432471e48b64523d5ddfcce (diff)
Check for nullret
-rw-r--r--FICS/ratings.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/FICS/ratings.c b/FICS/ratings.c
index c542fe4..b5cd5a7 100644
--- a/FICS/ratings.c
+++ b/FICS/ratings.c
@@ -1567,9 +1567,9 @@ PositionFilePtr(FILE *fp, int count, int *last, int *nTied, int showComp)
for (int i = 1; i < count; i++) {
do {
- fgets(line, sizeof line, fp);
-
- if (feof(fp))
+ if (fgets(line, sizeof line, fp) == NULL ||
+ feof(fp) ||
+ ferror(fp))
break;
sscanf(line, "%s %d %d %d", login, &rating, &nGames,
&is_computer);
@@ -1599,9 +1599,9 @@ ShowRankEntry(int p, FILE *fp, int count, int comp, char *target,
if (findable) {
do {
- fgets(newLine, sizeof newLine, fp);
-
- if (feof(fp)) {
+ if (fgets(newLine, sizeof newLine, fp) == NULL ||
+ feof(fp) ||
+ ferror(fp)) {
findable = 0;
} else if (newLine[0] != '\0') {
sscanf(newLine, "%s %d %d %d", login, &rating,