]> git.wh0rd.org Git - tt-rss.git/commitdiff
bugfix in check_lockfile() when file is not found
authorAndrew Dolgov <fox@madoka.spb.ru>
Fri, 25 Apr 2008 04:52:48 +0000 (05:52 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Fri, 25 Apr 2008 04:52:48 +0000 (05:52 +0100)
functions.php

index 9dbe9b27063bea6c3dc2eb39cdef5dcdf89136f3..5044976f1e1c23fc112feacdf59ae780a85ec63c 100644 (file)
                                }
                                fclose($fp);
                                return true;
+                       } else {
+                               return false;
                        }
                }
                return true; // consider the file always locked and skip the test
                $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;
                }