diff options
author | Urban Müller | 2011-09-29 17:16:11 +0000 |
---|---|---|
committer | Urban Müller | 2011-09-29 17:16:11 +0000 |
commit | 8c2af30bee2335786f13f5420e4e42f7fcdfcbc9 (patch) | |
tree | 1a5c95818c710fbf7015cf1c3dc4e8688b3bbb51 /it.class | |
parent | 6f20e84eec00c5a66c12dba9c102f67293a8cdcb (diff) | |
download | itools-8c2af30bee2335786f13f5420e4e42f7fcdfcbc9.tar.gz itools-8c2af30bee2335786f13f5420e4e42f7fcdfcbc9.tar.bz2 itools-8c2af30bee2335786f13f5420e4e42f7fcdfcbc9.zip |
fix race
Diffstat (limited to 'it.class')
-rw-r--r-- | it.class | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -84,15 +84,16 @@ static function log($name /* ... */) if (substr($fullfn, 0, 1) == "/") { - $existed = file_exists($fullfn); - file_put_contents($fullfn, $line, FILE_APPEND); - - if (!$existed) + if (!file_exists($fullfn)) { - @chgrp($fullfn, "www"); + @touch("$fullfn.tmp"); + @chgrp("$fullfn.tmp", "www"); + @rename("$fullfn.tmp", $fullfn); @unlink($basefn); @symlink($fullfn, $basefn); } + + file_put_contents($fullfn, $line, FILE_APPEND); } } |