]> git.wh0rd.org - tt-rss.git/commitdiff
file_is_locked: check if file exists before trying to flock it
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Tue, 28 May 2013 11:58:03 +0000 (15:58 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Tue, 28 May 2013 11:58:03 +0000 (15:58 +0400)
include/functions.php

index 7db040d04e57c81f2807aca5776c5fba06bba8b8..01ffa751fd7393e4925e2e09acc0c9c539772263 100644 (file)
        }
 
        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)) {