aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/ratings.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-07-07 14:43:19 +0200
committerMarkus Uhlin <markus@nifty-networks.net>2024-07-07 14:43:19 +0200
commit41a92d80a86dc2f2639d2374b50a0326a9b086ad (patch)
treecec7ecfbe455397983e0dea10ac96a5ed4df45cb /FICS/ratings.c
parent00b0bcbbb3fdbdddd62378975322baf83149b368 (diff)
Check return values
Diffstat (limited to 'FICS/ratings.c')
-rw-r--r--FICS/ratings.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/FICS/ratings.c b/FICS/ratings.c
index 92484a1..11896aa 100644
--- a/FICS/ratings.c
+++ b/FICS/ratings.c
@@ -326,13 +326,19 @@ load_ratings(void)
if ((fp = fopen(fname, "r")) == NULL) {
warn("%s: can't read ratings data", __func__);
return;
+ } else if (fscanf(fp, "%lf %lf %lf %d", &Rb_M, &Rb_S, &Rb_total,
+ &Rb_count) != 4 ||
+ fscanf(fp, "%lf %lf %lf %d", &Rs_M, &Rs_S, &Rs_total,
+ &Rs_count) != 4 ||
+ fscanf(fp, "%lf %lf %lf %d", &Rw_M, &Rw_S, &Rw_total,
+ &Rw_count) != 4 ||
+ fscanf(fp, "%lf %lf %lf %d", &Rl_M, &Rl_S, &Rl_total,
+ &Rl_count) != 4) {
+ warn("%s: fscanf", __func__);
+ fclose(fp);
+ return;
}
- fscanf(fp, "%lf %lf %lf %d", &Rb_M, &Rb_S, &Rb_total, &Rb_count);
- fscanf(fp, "%lf %lf %lf %d", &Rs_M, &Rs_S, &Rs_total, &Rs_count);
- fscanf(fp, "%lf %lf %lf %d", &Rw_M, &Rw_S, &Rw_total, &Rw_count);
- fscanf(fp, "%lf %lf %lf %d", &Rl_M, &Rl_S, &Rl_total, &Rl_count);
-
for (int i = 0; i < MAXHIST; i++) {
fscanf(fp, "%d %d %d %d", &sHist[i], &bHist[i], &wHist[i],
&lHist[i]);