summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStig Palmquist <stig@stig.io>2018-08-23 01:49:20 +0200
committerJoey Hess <joeyh@joeyh.name>2018-08-22 21:00:23 -0400
commit426ea36793e4b2253934b293c7734246f236efc2 (patch)
treeef424ceaee1d822d3e3ce2c4c7b84dc3d8c6845c
parent06b5970631ffbf151893bd3e1e7f03fb76aad4c0 (diff)
downloadmoreutils-426ea36793e4b2253934b293c7734246f236efc2.tar.gz
Set UNLINK=>1 in tempfile() to ensure cleanup if die() happens
-rwxr-xr-xvipe3
1 files changed, 1 insertions, 2 deletions
diff --git a/vipe b/vipe
index 2bf640d..8986d4e 100755
--- a/vipe
+++ b/vipe
@@ -43,7 +43,7 @@ use File::Temp q{tempfile};
$/=undef;
-my ($fh, $tmp)=tempfile();
+my ($fh, $tmp)=tempfile(UNLINK => 1);
die "cannot create tempfile" unless $fh;
print ($fh <STDIN>) || die "write temp: $!";
close $fh;
@@ -71,4 +71,3 @@ if ($ret != 0) {
open (IN, $tmp) || die "$0: cannot read $tmp: $!\n";
print (OUT <IN>) || die "write failure: $!";
close IN;
-unlink($tmp);