Added a file lock check during cache writing, as per suggestion at bug #3466
diff --git a/system/libraries/Output.php b/system/libraries/Output.php
index 781e368..98a941a 100644
--- a/system/libraries/Output.php
+++ b/system/libraries/Output.php
@@ -389,9 +389,16 @@
$expire = time() + ($this->cache_expiration * 60);
- flock($fp, LOCK_EX);
- fwrite($fp, $expire.'TS--->'.$output);
- flock($fp, LOCK_UN);
+ if (flock($fp, LOCK_EX))
+ {
+ fwrite($fp, $expire.'TS--->'.$output);
+ flock($fp, LOCK_UN);
+ }
+ else
+ {
+ log_message('error', "Unable to secure a file lock for file at: ".$cache_path);
+ return;
+ }
fclose($fp);
@chmod($cache_path, DIR_WRITE_MODE);