diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-07-07 20:46:56 +0200 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-07-07 20:46:56 +0200 |
commit | f0aadfd1993226f63a3086117f812a5bb3077b8d (patch) | |
tree | 3377f41cde83c65b0a81e015306e2eb243e1e98a /FICS | |
parent | 3b46a035bb0653d58e2a3df48e615c79cccbb84d (diff) |
Return value checking
Diffstat (limited to 'FICS')
-rw-r--r-- | FICS/obsproc.c | 16 |
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)) { |