summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrban Müller2017-03-29 19:27:22 +0200
committerUrban Müller2017-03-29 19:27:22 +0200
commita4f1a3241fda15df244cf77613e1405a8d50810b (patch)
treed261a2b6a25da2a945342d9e7e6ca07590aec4b0
parentf366953bd8aabeb7f4be7d33dc8d358a4839d8ba (diff)
downloaditools-a4f1a3241fda15df244cf77613e1405a8d50810b.tar.gz
itools-a4f1a3241fda15df244cf77613e1405a8d50810b.tar.bz2
itools-a4f1a3241fda15df244cf77613e1405a8d50810b.zip
prevent it::put tempfiles from being processed
-rw-r--r--it.class5
1 files changed, 3 insertions, 2 deletions
diff --git a/it.class b/it.class
index 30dbf92..a96032f 100644
--- a/it.class
+++ b/it.class
@@ -1037,8 +1037,9 @@ static function file_put($filename, $data, $p = array())
if ($p['mkdir'] && $filename != "-")
@mkdir(dirname($filename));
- if (($result = file_put_contents($filename == "-" ? "php://stdout" : "$filename.tmp." . getmypid(), $data)) !== false && $filename != "-")
- $result = rename("$filename.tmp." . getmypid(), $filename);
+ $tmpfile = dirname($filename) . "/.it_put." . basename($filename) . "." . getmypid();
+ if (($result = file_put_contents($filename == "-" ? "php://stdout" : $tmpfile, $data)) !== false && $filename != "-")
+ $result = rename($tmpfile, $filename);
return $result;
}