]> git.donarmstrong.com Git - perltidy.git/blob - debian/patches/die_on_unlink_failures
c950d7e846ade74375cc79467bc56a5b54a7cd9a
[perltidy.git] / debian / patches / die_on_unlink_failures
1 Description: die if perltidy.ERR and other temporary files cannot be unlinked
2 Origin: vendor, https://bugs.debian.org/862667
3 Author: Don Armstrong <don@debian.org>
4 --- a/lib/Perl/Tidy.pm
5 +++ b/lib/Perl/Tidy.pm
6 @@ -3692,7 +3692,9 @@
7      # now wish for luck...
8      my $msg = qx/perl $flags $quoted_stream_filename $error_redirection/;
9  
10 -    unlink $stream_filename if ($is_tmpfile);
11 +    unlink $stream_filename or
12 +        Perl::Tidy::Die("couldn't unlink stream ${stream_filename}: $!\n")
13 +            if ($is_tmpfile);
14      return $stream_filename, $msg;
15  }
16  
17 @@ -4128,7 +4130,10 @@
18  
19      # remove any old error output file if we might write a new one
20      unless ( $fh_warnings || ref($warning_file) ) {
21 -        if ( -e $warning_file ) { unlink($warning_file) }
22 +        if ( -e $warning_file ) {
23 +            unlink($warning_file) or
24 +                Perl::Tidy::Die("couldn't unlink warning file ${warning_file}: $!\n");
25 +        }
26      }
27  
28      my $logfile_gap =