file_is_locked: check if file exists before trying to flock it
This commit is contained in:
parent
2a7362596f
commit
1d76589693
|
@ -961,7 +961,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function file_is_locked($filename) {
|
function file_is_locked($filename) {
|
||||||
if (function_exists('flock')) {
|
if (function_exists('flock') && file_exists(LOCK_DIRECTORY . "/$filename")) {
|
||||||
$fp = @fopen(LOCK_DIRECTORY . "/$filename", "r");
|
$fp = @fopen(LOCK_DIRECTORY . "/$filename", "r");
|
||||||
if ($fp) {
|
if ($fp) {
|
||||||
if (flock($fp, LOCK_EX | LOCK_NB)) {
|
if (flock($fp, LOCK_EX | LOCK_NB)) {
|
||||||
|
|
Loading…
Reference in New Issue