From 1d7658969352ee73dd94baf3cea15364dd303786 Mon Sep 17 00:00:00 2001
From: Andrew Dolgov <fox@madoka.volgo-balt.ru>
Date: Tue, 28 May 2013 15:58:03 +0400
Subject: [PATCH] file_is_locked: check if file exists before trying to flock
 it

---
 include/functions.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/functions.php b/include/functions.php
index 7db040d04..01ffa751f 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -961,7 +961,7 @@
 	}
 
 	function file_is_locked($filename) {
-		if (function_exists('flock')) {
+		if (function_exists('flock') && file_exists(LOCK_DIRECTORY . "/$filename")) {
 			$fp = @fopen(LOCK_DIRECTORY . "/$filename", "r");
 			if ($fp) {
 				if (flock($fp, LOCK_EX | LOCK_NB)) {
-- 
GitLab