aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/gamedb.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-07-20 13:01:27 +0200
committerMarkus Uhlin <markus@nifty-networks.net>2024-07-20 13:01:27 +0200
commitd41654e7cb05e4b4fe537dc35c165b46ad0ac71f (patch)
treeb67e47b3d3ede549c24722bb64e364d752d83db1 /FICS/gamedb.c
parent70f1c4fc7baec461c33828d921805c35d3dbb0d5 (diff)
OldestHistGame: handle the return of fscanf()
Diffstat (limited to 'FICS/gamedb.c')
-rw-r--r--FICS/gamedb.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/FICS/gamedb.c b/FICS/gamedb.c
index ee71af4..3b3c3aa 100644
--- a/FICS/gamedb.c
+++ b/FICS/gamedb.c
@@ -1542,8 +1542,13 @@ OldestHistGame(char *login)
}
if (fp != NULL) {
- fscanf(fp, "%*d %*c %*d %*c %*d %*s %*s %*d %*d %*d %*d %*s "
- "%*s %ld", &when);
+ if (fscanf(fp, "%*d %*c %*d %*c %*d %*s %*s %*d %*d %*d %*d "
+ "%*s %*s %ld", &when) != 1) {
+ warnx("%s: %s: failed to read 'when'", __func__,
+ &pFile[0]);
+ fclose(fp);
+ return 0L;
+ }
fclose(fp);
return when;
} else