From 2a76ffdf925f9539751a61cc3bc6816289f2ae84 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Tue, 12 Nov 2024 02:59:51 -0500
Subject: [PATCH] Add a bit of paranoia to the infinite loop in lock_cfg() too.

---
 exec/imapservice.js | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/exec/imapservice.js b/exec/imapservice.js
index f112694ba1..3d3c50f15a 100644
--- a/exec/imapservice.js
+++ b/exec/imapservice.js
@@ -1409,8 +1409,13 @@ function open_cfg(usr)
 
 function lock_cfg()
 {
-	while(!cfgfile.lock(0, 1))
+	while(!cfgfile.lock(0, 1)) {
+		if (!client.socket.is_connected)
+			exit(0);
+		if (js.termianted)
+			exit(0);
 		mswait(10);
+	}
 }
 
 function unlock_cfg()
-- 
GitLab