about summary refs log tree commit diff
path: root/scripts/readmanifest.pm.in
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-12-29T19·04+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-12-29T19·04+0000
commit2fdb27e7f21c99174d35556575e3d25bf2bdc23e (patch)
tree303a1fc8b8c6907f49441554b0b5da3076d4d931 /scripts/readmanifest.pm.in
parente1e9c036f9313ac6bf160dba67e694b7868f1567 (diff)
* Atomic file replacement is good.
Diffstat (limited to 'scripts/readmanifest.pm.in')
-rw-r--r--scripts/readmanifest.pm.in5
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/readmanifest.pm.in b/scripts/readmanifest.pm.in
index 766aa4219944..31ea5f43cc56 100644
--- a/scripts/readmanifest.pm.in
+++ b/scripts/readmanifest.pm.in
@@ -146,7 +146,7 @@ sub writeManifest
     my $patches = shift;
     my $successors = shift;
 
-    open MANIFEST, ">$manifest";
+    open MANIFEST, ">$manifest.tmp"; # !!! check exclusive
 
     foreach my $storePath (keys %{$narFiles}) {
         my $narFileList = $$narFiles{$storePath};
@@ -184,6 +184,9 @@ sub writeManifest
     
     
     close MANIFEST;
+
+    rename("$manifest.tmp", $manifest)
+        or die "cannot rename $manifest.tmp: $!";
 }