aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-07-07 20:46:56 +0200
committerMarkus Uhlin <markus@nifty-networks.net>2024-07-07 20:46:56 +0200
commitf0aadfd1993226f63a3086117f812a5bb3077b8d (patch)
tree3377f41cde83c65b0a81e015306e2eb243e1e98a
parent3b46a035bb0653d58e2a3df48e615c79cccbb84d (diff)
Return value checking
-rw-r--r--FICS/obsproc.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/FICS/obsproc.c b/FICS/obsproc.c
index 43d0ace..cd661b0 100644
--- a/FICS/obsproc.c
+++ b/FICS/obsproc.c
@@ -961,8 +961,12 @@ FindHistory(int p, int p1, int game)
}
do {
- fscanf(fpHist, "%d %*c %*d %*c %*d %*s %*s %*d %*d %*d %*d "
- "%*s %*s %ld", &index, &when);
+ int ret;
+
+ ret = fscanf(fpHist, "%d %*c %*d %*c %*d %*s %*s %*d %*d %*d "
+ "%*d %*s %*s %ld", &index, &when);
+ if (ret != 2)
+ warn("%s: %s: corrupt", __func__, &fileName[0]);
} while (!feof(fpHist) && index != game);
if (feof(fpHist)) {
@@ -996,8 +1000,12 @@ FindHistory2(int p, int p1, int game, char *End)
}
do {
- fscanf(fpHist, "%d %*c %*d %*c %*d %*s %*s %*d %*d %*d %*d "
- "%*s %s %ld", &index, End, &when);
+ int ret;
+
+ ret = fscanf(fpHist, "%d %*c %*d %*c %*d %*s %*s %*d %*d %*d "
+ "%*d %*s %s %ld", &index, End, &when);
+ if (ret != 3)
+ warn("%s: %s: corrupt", __func__, &fileName[0]);
} while (!feof(fpHist) && index != game);
if (feof(fpHist)) {