From 0baec4f9ed0fa1c1b37a52ad1c4df5f1ff48b3b8 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Wed, 27 Nov 2024 03:09:42 +0100 Subject: write_g_out: made improvements --- FICS/gamedb.c | 9 ++++----- 1 file 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); -- cgit v1.2.3