diff options
author | Stig Palmquist <stig@stig.io> | 2018-08-23 01:49:20 +0200 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2018-08-22 21:00:23 -0400 |
commit | 426ea36793e4b2253934b293c7734246f236efc2 (patch) | |
tree | ef424ceaee1d822d3e3ce2c4c7b84dc3d8c6845c | |
parent | 06b5970631ffbf151893bd3e1e7f03fb76aad4c0 (diff) | |
download | moreutils-426ea36793e4b2253934b293c7734246f236efc2.tar.gz |
Set UNLINK=>1 in tempfile() to ensure cleanup if die() happens
-rwxr-xr-x | vipe | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -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); |