summaryrefslogtreecommitdiffstats
path: root/system/libraries/Output.php
diff options
context:
space:
mode:
authorRick Ellis <rick.ellis@ellislab.com>2008-10-07 03:09:40 +0200
committerRick Ellis <rick.ellis@ellislab.com>2008-10-07 03:09:40 +0200
commit9f0de7967cc2c5fe8140a3042bb900c43ab8336c (patch)
tree491876a60b9efa192ebb8e56fe6874266c665de2 /system/libraries/Output.php
parent06a2e74e8834e88e4639d17dc756403985ca00f8 (diff)
Added a file lock check during cache writing, as per suggestion at bug #3466
Diffstat (limited to 'system/libraries/Output.php')
-rw-r--r--system/libraries/Output.php13
1 files changed, 10 insertions, 3 deletions
diff --git a/system/libraries/Output.php b/system/libraries/Output.php
index 781e368cb..98a941af5 100644
--- a/system/libraries/Output.php
+++ b/system/libraries/Output.php
@@ -389,9 +389,16 @@ class CI_Output {
$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);