From: Andrew Dolgov Date: Fri, 25 Apr 2008 04:52:48 +0000 (+0100) Subject: bugfix in check_lockfile() when file is not found X-Git-Tag: 1.2.22.1~19 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=e89aed7bb53760d27803a22c086893b0cd75233c;p=tt-rss.git bugfix in check_lockfile() when file is not found --- diff --git a/functions.php b/functions.php index 9dbe9b27..5044976f 100644 --- a/functions.php +++ b/functions.php @@ -1967,6 +1967,8 @@ } fclose($fp); return true; + } else { + return false; } } return true; // consider the file always locked and skip the test @@ -2001,11 +2003,15 @@ $fp = fopen(LOCK_DIRECTORY . "/$filename", "r"); error_reporting (DEFAULT_ERROR_LEVEL); - if (flock($fp, LOCK_EX)) { - $stamp = fgets($fp); - flock($fp, LOCK_UN); - fclose($fp); - return $stamp; + if ($fp) { + if (flock($fp, LOCK_EX)) { + $stamp = fgets($fp); + flock($fp, LOCK_UN); + fclose($fp); + return $stamp; + } else { + return false; + } } else { return false; }