[ci skip] Move flock() call in CI_Log::write_log() immediately after fopen()
diff --git a/system/core/Log.php b/system/core/Log.php
index 7c81d35..1abdaa0 100644
--- a/system/core/Log.php
+++ b/system/core/Log.php
@@ -191,6 +191,8 @@
return FALSE;
}
+ flock($fp, LOCK_EX);
+
// Instantiating DateTime with microseconds appended to initial date is needed for proper support of this format
if (strpos($this->_date_fmt, 'u') !== FALSE)
{
@@ -206,8 +208,6 @@
$message .= $this->_format_line($level, $date, $msg);
- flock($fp, LOCK_EX);
-
for ($written = 0, $length = strlen($message); $written < $length; $written += $result)
{
if (($result = fwrite($fp, substr($message, $written))) === FALSE)