mirror of
git://git.proxmox.com/git/pve-common.git
synced 2025-01-03 09:17:36 +03:00
tools: download file: refactor rename call
by reusing the tmp_download variable for the decompression case too. Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> Reviewed-by: Fiona Ebner <f.ebner@proxmox.com> Tested-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
parent
903d285751
commit
d8582cd045
@ -2146,10 +2146,10 @@ sub download_file_from_url {
|
||||
print "decompressing $tmp_download to $tmp_decomp\n";
|
||||
run_command($cmd, output => '>&'.fileno($fh));
|
||||
unlink $tmp_download;
|
||||
rename($tmp_decomp, $dest) or die "unable to rename temporary file: $!\n";
|
||||
} else {
|
||||
rename($tmp_download, $dest) or die "unable to rename temporary file: $!\n";
|
||||
$tmp_download = $tmp_decomp;
|
||||
}
|
||||
|
||||
rename($tmp_download, $dest) or die "unable to rename temporary file: $!\n";
|
||||
};
|
||||
if (my $err = $@) {
|
||||
unlink $tmp_download or warn "could not cleanup temporary file: $!"
|
||||
|
Loading…
Reference in New Issue
Block a user