diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2025-04-06 20:30:50 +0200 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2025-04-06 20:30:50 +0200 |
commit | 60713dfc3219bc2c4992e408e0c553e763cea896 (patch) | |
tree | 6dc38b452168d670e1416791235721cf2bac2607 /FICS | |
parent | 95b31f5f513d46a7ac7ba7b09ea69daf6cda3f71 (diff) |
Fixed Clang Tidy warnings in FindHistory() and FindHistory2()
Diffstat (limited to 'FICS')
-rw-r--r-- | FICS/obsproc.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/FICS/obsproc.c b/FICS/obsproc.c index 11cf1bc..408d66b 100644 --- a/FICS/obsproc.c +++ b/FICS/obsproc.c @@ -982,11 +982,16 @@ FindHistory(int p, int p1, int p_game) 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 != p_game); + if (ret != 2) { + warnx("%s: %s: corrupt", __func__, fileName); + fclose(fpHist); + return NULL; + } + } while (!feof(fpHist) && + !ferror(fpHist) && + index != p_game); - if (feof(fpHist)) { + if (feof(fpHist) || ferror(fpHist)) { pprintf(p, "There is no history game %d for %s.\n", p_game, parray[p1].name); fclose(fpHist); @@ -1021,11 +1026,16 @@ FindHistory2(int p, int p1, int p_game, char *End, const size_t End_size) "%%*d %%*d %%*d %%*s %%%zus %%ld\n", (End_size - 1)); do { - if (fscanf(fpHist, fmt, &index, End, &when) != 3) - warn("%s: %s: corrupt", __func__, &fileName[0]); - } while (!feof(fpHist) && index != p_game); + if (fscanf(fpHist, fmt, &index, End, &when) != 3) { + warnx("%s: %s: corrupt", __func__, fileName); + fclose(fpHist); + return NULL; + } + } while (!feof(fpHist) && + !ferror(fpHist) && + index != p_game); - if (feof(fpHist)) { + if (feof(fpHist) || ferror(fpHist)) { pprintf(p, "There is no history game %d for %s.\n", p_game, parray[p1].name); fclose(fpHist); |