From ab489f5d2aa19f0bd02431dfe4ac3ed4b3360700 Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Tue, 20 Jan 2009 20:50:26 +0000
Subject: [PATCH] Fix bug in read lock detection, work around problem when
 js.auto_terminate is true and the script exited becuase of that.

---
 exec/load/lockfile.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/exec/load/lockfile.js b/exec/load/lockfile.js
index 134290b8ee..c84195f39c 100644
--- a/exec/load/lockfile.js
+++ b/exec/load/lockfile.js
@@ -57,7 +57,7 @@ function Lock(filename, lockid, forwrite, timeout)
 					if(LockedFiles[filename]!=undefined)
 						file_remove(readlock.name);
 					/* We have got the lock... wait for all read locks to close */
-					while(file_exists(filename+".lock_*")) {
+					while(file_exists(filename+".lock.*")) {
 						mswait(1);
 						if(system.timer > endtime) {
 							/* If we were upgrading, restor our old lock... */
@@ -111,7 +111,10 @@ function Unlock(filename)
 
 function UnlockAll()
 {
+	var old_at=js.auto_terminate;
+	js.auto_terminate=false;
 	for(filename in LockedFiles) {
 		Unlock(filename);
 	}
+	js.auto_terminate=old_at;
 }
-- 
GitLab