diff options
author | Urban Müller | 2011-10-19 14:21:19 +0000 |
---|---|---|
committer | Urban Müller | 2011-10-19 14:21:19 +0000 |
commit | 26032604baf84a6e603bd7d47cde51e17dc58269 (patch) | |
tree | 5f056886209eada318b924133415fffe2543356d | |
parent | 10c8d19db9ad1639fa2b63bf3588ed7748817ed1 (diff) | |
download | itools-26032604baf84a6e603bd7d47cde51e17dc58269.tar.gz itools-26032604baf84a6e603bd7d47cde51e17dc58269.tar.bz2 itools-26032604baf84a6e603bd7d47cde51e17dc58269.zip |
fix race
-rw-r--r-- | it.class | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -86,9 +86,10 @@ static function log($name /* ... */) { if (!file_exists($fullfn)) { - @touch("$fullfn.tmp"); - @chgrp("$fullfn.tmp", "www"); - @rename("$fullfn.tmp", $fullfn); + $tmp = getmypid(); + @touch("$fullfn.$tmp"); + @chgrp("$fullfn.$tmp", "www"); + @rename("$fullfn.$tmp", $fullfn); @unlink($basefn); @symlink($fullfn, $basefn); } |