From 9f0de7967cc2c5fe8140a3042bb900c43ab8336c Mon Sep 17 00:00:00 2001 From: Rick Ellis Date: Tue, 7 Oct 2008 01:09:40 +0000 Subject: Added a file lock check during cache writing, as per suggestion at bug #3466 --- system/libraries/Output.php | 13 ++++++++++--- 1 file 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); -- cgit v1.2.3-24-g4f1b