diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-11-27 03:09:42 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-11-27 03:09:42 +0100 |
commit | 0baec4f9ed0fa1c1b37a52ad1c4df5f1ff48b3b8 (patch) | |
tree | c1d202899cd839cffd3c506baa2f991e30f25878 | |
parent | 2dd3b75819254ff7e22a10e67908e56ec961e148 (diff) |
write_g_out: made improvements
-rw-r--r-- | FICS/gamedb.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/FICS/gamedb.c b/FICS/gamedb.c index ad7ef78..3a5c50c 100644 --- a/FICS/gamedb.c +++ b/FICS/gamedb.c @@ -1769,11 +1769,10 @@ write_g_out(int g, char *file, int maxlines, int isDraw, char *EndSymbol, type[3] = '\0'; - fp = fopen(file, "r"); - - if (fp) { - while (!feof(fp)) - fgets(tmp, 1024, fp); + if ((fp = fopen(file, "r")) != NULL) { + while (fgets(tmp, sizeof tmp, fp) != NULL) { + /* null */; + } if (sscanf(ptmp, "%d", &count) != 1) warnx("%s: failed to read 'count'", __func__); fclose(fp); |