cleanup previous commit - use IO::File

This commit is contained in:
Dietmar Maurer 2014-05-17 09:07:18 +02:00
parent 15b21acc0d
commit 46f58b5f03

View File

@ -1126,15 +1126,15 @@ sub print_drivedevice_full {
}
sub get_initiator_name {
my $initiator = undef;
my $initiator;
open (FILE, '/etc/iscsi/initiatorname.iscsi') or return undef;
while (<FILE>) {
next unless m/^\s*InitiatorName\s*=\s*([\.\-:\w]+)/;
my $fh = IO::File->new('/etc/iscsi/initiatorname.iscsi') || return undef;
while (defined(my $line = <$fh>)) {
next if $line !~ m/^\s*InitiatorName\s*=\s*([\.\-:\w]+)/;
$initiator = $1;
last;
}
close FILE;
$fh->close();
return $initiator;
}