mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-08 00:49:11 +00:00
cleanup previous commit - use IO::File
This commit is contained in:
parent
15b21acc0d
commit
46f58b5f03
@ -1126,15 +1126,15 @@ sub print_drivedevice_full {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub get_initiator_name {
|
sub get_initiator_name {
|
||||||
my $initiator = undef;
|
my $initiator;
|
||||||
|
|
||||||
open (FILE, '/etc/iscsi/initiatorname.iscsi') or return undef;
|
my $fh = IO::File->new('/etc/iscsi/initiatorname.iscsi') || return undef;
|
||||||
while (<FILE>) {
|
while (defined(my $line = <$fh>)) {
|
||||||
next unless m/^\s*InitiatorName\s*=\s*([\.\-:\w]+)/;
|
next if $line !~ m/^\s*InitiatorName\s*=\s*([\.\-:\w]+)/;
|
||||||
$initiator = $1;
|
$initiator = $1;
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
close FILE;
|
$fh->close();
|
||||||
|
|
||||||
return $initiator;
|
return $initiator;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user