file_is_locked: check if file exists before trying to flock it

This commit is contained in:
Andrew Dolgov 2013-05-28 15:58:03 +04:00
parent 2a7362596f
commit 1d76589693
1 changed files with 1 additions and 1 deletions

View File

@ -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)) {