aboutsummaryrefslogtreecommitdiff
path: root/scripts/nix-pack-closure.in
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-10-04 18:58:11 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-10-04 18:58:11 +0000
commitd98f750fd8de5a0546903061e94b9bda3f68681f (patch)
treec689b6225fdf0160091caf39c4c4770dbf787a12 /scripts/nix-pack-closure.in
parent34427a7b43382215774b1a164fd784a0f7804d33 (diff)
* tmpnam() -> File::Temp::tempdir().
Diffstat (limited to 'scripts/nix-pack-closure.in')
-rw-r--r--scripts/nix-pack-closure.in9
1 files changed, 4 insertions, 5 deletions
diff --git a/scripts/nix-pack-closure.in b/scripts/nix-pack-closure.in
index ebf716407..6c0e85d2a 100644
--- a/scripts/nix-pack-closure.in
+++ b/scripts/nix-pack-closure.in
@@ -9,15 +9,14 @@
# directory.
use strict;
-use POSIX qw(tmpnam);
+use File::Temp qw(tempdir);
my $binDir = $ENV{"NIX_BIN_DIR"};
$binDir = "@bindir@" unless defined $binDir;
-my $tmpDir;
-do { $tmpDir = tmpnam(); }
-until mkdir $tmpDir, 0777;
-END { my $x = $?; system("@coreutils@/rm", "-rf", $tmpDir); $? = $x; }
+my $tmpDir = tempdir("nix-pack-closure.XXXXXX", CLEANUP => 1, TMPDIR => 1)
+ or die "cannot create a temporary directory";
+
mkdir "$tmpDir/contents", 0777 or die;
mkdir "$tmpDir/references", 0777 or die;
mkdir "$tmpDir/derivers", 0777 or die;