From ed94a0d6e73b6ac052d8027c34148238f4a8c21e Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Tue, 7 Aug 2018 02:16:26 +0000
Subject: [PATCH] If the user number is 0, don't open the user file (user.dat)
 - the read of the user record is going to fail anyway. *this* explains a lot
 of instances of the user.dat file being open concurrently, at least one per
 active thread with a JS context.

---
 src/sbbs3/js_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/sbbs3/js_user.c b/src/sbbs3/js_user.c
index e8992c091d..1493b6add2 100644
--- a/src/sbbs3/js_user.c
+++ b/src/sbbs3/js_user.c
@@ -128,7 +128,7 @@ enum {
 
 static void js_getuserdat(scfg_t* scfg, private_t* p)
 {
-	if(!p->cached) {
+	if(p->user->number != 0 && !p->cached) {
 		if(p->file < 1)
 			p->file = openuserdat(scfg, /* for_modify: */FALSE);
 		if(fgetuserdat(scfg, p->user, p->file)==0)
-- 
GitLab