From f609ac6ce9e3cbe09dd500fdcde6456f72c60d94 Mon Sep 17 00:00:00 2001
From: Rob Swindell <rob@synchro.net>
Date: Tue, 29 Mar 2022 20:15:17 -0700
Subject: [PATCH] Use fnopen() in fopen_dstats() to get open auto-retries

iniFileOpen() does not perform retries and there can be contention for the ctrl/dsts.ini file.
---
 src/sbbs3/getstats.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/sbbs3/getstats.c b/src/sbbs3/getstats.c
index e9f46c0dd7..a9c4ceff8e 100644
--- a/src/sbbs3/getstats.c
+++ b/src/sbbs3/getstats.c
@@ -66,7 +66,7 @@ FILE* fopen_dstats(scfg_t* cfg, uint node, BOOL for_write)
     char path[MAX_PATH+1];
 
 	dstats_fname(cfg, node, path, sizeof(path));
-	return iniOpenFile(path, for_write);
+	return fnopen(NULL, path, for_write ? O_CREAT|O_RDWR : O_RDONLY);
 }
 
 /****************************************************************************/
@@ -83,7 +83,7 @@ FILE* fopen_cstats(scfg_t* cfg, uint node, BOOL for_write)
 /****************************************************************************/
 BOOL fclose_dstats(FILE* fp)
 {
-	return iniCloseFile(fp);
+	return fclose(fp);
 }
 
 /****************************************************************************/
-- 
GitLab