summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2016-01-10 11:18:00 +0100
committerYorhel <git@yorhel.nl>2016-01-10 11:18:39 +0100
commit279ac5d9bf1162824849ba0bb71c3fdad33b20d1 (patch)
treee6e0f4db421be014dab7c237858cf6bd0a9c6d16 /util
parentb7a14f5696097d381ba68ad438b040f1c9067e92 (diff)
Use atomic replace when writing .gz assets
Diffstat (limited to 'util')
-rwxr-xr-xutil/jsgen.pl5
-rwxr-xr-xutil/skingen.pl5
2 files changed, 8 insertions, 2 deletions
diff --git a/util/jsgen.pl b/util/jsgen.pl
index c677d791..36adea0d 100755
--- a/util/jsgen.pl
+++ b/util/jsgen.pl
@@ -184,7 +184,10 @@ sub save {
rename "$f~", $f or die $!;
- `$VNDB::JSGEN{gzip} -c '$f' >'$f.gz'` if $VNDB::JSGEN{gzip};
+ if($VNDB::JSGEN{gzip}) {
+ `$VNDB::JSGEN{gzip} -c '$f' >'$f.gz~'`;
+ rename "$f.gz~", "$f.gz";
+ }
}
sub jsgen {
diff --git a/util/skingen.pl b/util/skingen.pl
index aa5db2d5..6648d6b6 100755
--- a/util/skingen.pl
+++ b/util/skingen.pl
@@ -80,7 +80,10 @@ sub writeskin { # $name
rename "$f~", $f;
- `$VNDB::SKINGEN{gzip} -c '$f' >'$f.gz'` if $VNDB::SKINGEN{gzip};
+ if($VNDB::SKINGEN{gzip}) {
+ `$VNDB::SKINGEN{gzip} -c '$f' >'$f.gz~'`;
+ rename "$f.gz~", "$f.gz";
+ }
}