5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2024-12-23 17:34:19 +03:00

fix some FH close

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-10-19 15:30:21 +02:00
parent 41af2dfc25
commit 808a65b522
2 changed files with 6 additions and 7 deletions

View File

@ -1157,11 +1157,11 @@ my $kvm_api_version = 0;
sub kvm_version {
return $kvm_api_version if $kvm_api_version;
open my $fh, '<', '/dev/kvm'
or return;
open my $fh, '<', '/dev/kvm' or return;
# 0xae00 => KVM_GET_API_VERSION
$kvm_api_version = ioctl($fh, 0xae00, 0);
close($fh);
return $kvm_api_version;
}
@ -6244,10 +6244,7 @@ sub restore_vma_archive {
my $mapfifo = "/var/tmp/vzdumptmp$$.fifo";
POSIX::mkfifo($mapfifo, 0600);
my $fifofh;
my $openfifo = sub {
open($fifofh, '>', $mapfifo) || die $!;
};
my $openfifo = sub { open($fifofh, '>', $mapfifo) or die $! };
$add_pipe->(['vma', 'extract', '-v', '-r', $mapfifo, $readfrom, $tmpdir]);
@ -6372,6 +6369,7 @@ sub restore_vma_archive {
$oldtimeout = undef;
alarm($tmp);
close($fifofh);
$fifofh = undef;
}
};
@ -6384,6 +6382,7 @@ sub restore_vma_archive {
$restore_deactivate_volumes->($cfg, $devinfo);
close($fifofh) if $fifofh;
unlink $mapfifo;
rmtree $tmpdir;

View File

@ -288,7 +288,7 @@ sub diff($$) {
my $ha = IO::Handle->new_from_fd($wa, 'w');
my $hb = IO::Handle->new_from_fd($wb, 'w');
open my $diffproc, '-|', 'diff', '-up', "/proc/self/fd/$ra", "/proc/self/fd/$rb"
open my $diffproc, '-|', 'diff', '-up', "/proc/self/fd/$ra", "/proc/self/fd/$rb" ## no critic
or die "failed to run program 'diff': $!";
POSIX::close($ra);
POSIX::close($rb);