mirror of
https://git.proxmox.com/git/pve-common
synced 2025-04-29 16:08:48 +00:00
download file from url: improve cleanup
don't attempt cleanup if temp files don't exist (anymore, or not yet). Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
a4df83987b
commit
0bf2e89a39
@ -2017,9 +2017,10 @@ sub download_file_from_url {
|
|||||||
my $tmp_decomp = "$dest.tmp_dcom.$$";
|
my $tmp_decomp = "$dest.tmp_dcom.$$";
|
||||||
eval {
|
eval {
|
||||||
local $SIG{INT} = sub {
|
local $SIG{INT} = sub {
|
||||||
unlink $tmp_download or warn "could not cleanup temporary file: $!";
|
unlink $tmp_download or warn "could not cleanup temporary file: $!"
|
||||||
|
if -e $tmp_download;
|
||||||
unlink $tmp_decomp or warn "could not cleanup temporary file: $!"
|
unlink $tmp_decomp or warn "could not cleanup temporary file: $!"
|
||||||
if $opts->{decompression_command};
|
if $opts->{decompression_command} && -e $tmp_decomp;
|
||||||
die "got interrupted by signal\n";
|
die "got interrupted by signal\n";
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2069,9 +2070,10 @@ sub download_file_from_url {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (my $err = $@) {
|
if (my $err = $@) {
|
||||||
unlink $tmp_download or warn "could not cleanup temporary file: $!";
|
unlink $tmp_download or warn "could not cleanup temporary file: $!"
|
||||||
|
if -e $tmp_download;
|
||||||
unlink $tmp_decomp or warn "could not cleanup temporary file: $!"
|
unlink $tmp_decomp or warn "could not cleanup temporary file: $!"
|
||||||
if $opts->{decompression_command};
|
if $opts->{decompression_command} && -e $tmp_decomp;
|
||||||
die $err;
|
die $err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user