3
0
Fork 0
mirror of https://github.com/fsr/eseeva synced 2025-04-28 17:38:31 +02:00

fixes truncation aat write access

This commit is contained in:
Lucas Woltmann 2016-08-02 09:55:26 +02:00
parent 3637b0c7b9
commit db9faaf3d9
2 changed files with 6 additions and 2 deletions

View file

@ -200,7 +200,7 @@
*/
function WriteLogFile($fileName, &$questionData, &$tutorData, &$commentData)
{
$handle = fopen($fileName, 'w');
$handle = fopen($fileName, 'c');
if (!$handle)
return false;
// write disclaimer and question data block identifier
@ -234,7 +234,9 @@
// write the generated data to the file and close it
// use exclusive lock
flock($handle, LOCK_EX);
ftruncate($handle, 0);
fwrite($handle, $fileData);
fflush($handle);
flock($handle, LOCK_UN);
fclose($handle);
return true;