From 44ce881b07782f3f622d28eafcfecd3dea33cac3 Mon Sep 17 00:00:00 2001
From: "Rob Swindell (on Windows 11)" <rob@synchro.net>
Date: Mon, 18 Nov 2024 10:30:32 -0800
Subject: [PATCH] We need to initialize the fd to -1 here (since we zero-it out
 the fmutex_t)

and might return before setting it to anything else.
---
 src/sbbs3/nopen.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/sbbs3/nopen.c b/src/sbbs3/nopen.c
index 8d2e0cb340..53ece88fde 100644
--- a/src/sbbs3/nopen.c
+++ b/src/sbbs3/nopen.c
@@ -128,6 +128,7 @@ bool _fmutex_open(const char* fname, const char* text, long max_age, bool auto_r
 	if(fm == NULL)
 		return false;
 	memset(fm, 0, sizeof *fm);
+	fm->fd = -1;
 	snprintf(fm->name, sizeof fm->name, fname);
 	if(max_age > 0) {
 		fm->time = fdate(fname);
-- 
GitLab