Skip to content

Commit

Permalink
Prevent inconstitent /data/trafic_limiter.php due to file read while …
Browse files Browse the repository at this point in the history
…writing
  • Loading branch information
jeldrik committed Sep 28, 2013
1 parent 43fa904 commit 71a7f6a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function trafic_limiter_canPass($ip)
// FIXME: purge file of expired IPs to keep it small
}
$tl[$ip]=time();
file_put_contents($tfilename, "<?php\n\$GLOBALS['trafic_limiter']=".var_export($tl,true).";\n?>");
file_put_contents($tfilename, "<?php\n\$GLOBALS['trafic_limiter']=".var_export($tl,true).";\n?>", LOCK_EX);
return true;
}

Expand Down

0 comments on commit 71a7f6a

Please sign in to comment.