From 7a3fd562cb80da8881a5cebeab0641fcb7b2af30 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Sat, 4 Oct 2025 13:55:04 +0200 Subject: Refer to the array indices by using enums --- FICS/ratings.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'FICS/ratings.c') diff --git a/FICS/ratings.c b/FICS/ratings.c index a85776d..8113c6d 100644 --- a/FICS/ratings.c +++ b/FICS/ratings.c @@ -418,10 +418,7 @@ save_ratings(void) snprintf(fname, sizeof fname, "%s/newratingsV%d_data", stats_dir, STATS_VERSION); - errno = 0; - fd = open(fname, g_open_flags[1], g_open_modes); - - if (fd < 0) { + if ((fd = open(fname, g_open_flags[OPFL_WRITE], g_open_modes)) < 0) { warn("%s: can't write ratings data", __func__); return; } else if ((fp = fdopen(fd, "w")) == NULL) { @@ -1501,10 +1498,8 @@ UpdateRank(int type, char *addName, statistics *sNew, char *delName) snprintf(TmpRankFile, sizeof TmpRankFile, "%s/tmpRank", sdir); - errno = 0; - fd = open(TmpRankFile, g_open_flags[1], g_open_modes); - - if (fd < 0) { + if ((fd = open(TmpRankFile, g_open_flags[OPFL_WRITE], + g_open_modes)) < 0) { warn("%s: open", __func__); fclose(fp); return; -- cgit v1.2.3