error handling

This commit is contained in:
Savetheinternet 2011-05-20 17:22:08 +10:00
parent d8301964b1
commit 62db62669e

View File

@ -212,11 +212,12 @@
}
function file_write($path, $data) {
$fp = fopen($path, 'c');
if(!$fp = fopen($path, 'c'))
error('Unable to open file for writing: ' . $path);
// File locking
if(!flock($fp, LOCK_EX)) {
error('Unable to lock file!');
error('Unable to lock file: ' . $path);
}
// Truncate file