From 1bbb222525f9c60d4e641f5436f1fd84552d83d9 Mon Sep 17 00:00:00 2001
From: Rob Swindell <rob@synchro.net>
Date: Sat, 21 Jan 2023 13:05:50 -0800
Subject: [PATCH] Don't attempt to remove a non-existing qwk-pack semfile

Reduce occurrences of subsequent errors (unsure of root-cause):
!ERROR 2 (No such file or directory) in main.cpp line 2778 (event_thread) removing "/sbbs/data/pack0341.now"

This does seem to be the only location that deleted pack*.now files, so weird that they'd disappear sometime after calling glob(), but I do understand that its theoretically possible.
---
 src/sbbs3/main.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/sbbs3/main.cpp b/src/sbbs3/main.cpp
index c022e9a7a5..110cfb46c6 100644
--- a/src/sbbs3/main.cpp
+++ b/src/sbbs3/main.cpp
@@ -2774,7 +2774,7 @@ void event_thread(void* arg)
 					sbbs->console&=~CON_L_ECHO;
 					sbbs->online=FALSE;
 				}
-				if(remove(g.gl_pathv[i]))
+				if(fexist(g.gl_pathv[i]) && remove(g.gl_pathv[i]) != 0)
 					sbbs->errormsg(WHERE, ERR_REMOVE, g.gl_pathv[i], 0);
 				if(remove(semfile))
 					sbbs->errormsg(WHERE, ERR_REMOVE, semfile, 0);
-- 
GitLab