fix 'Bareword file handle opened'

This commit is contained in:
Christian Loos 2016-08-30 13:27:13 +02:00
parent f3e3b39023
commit 90e8251523

View file

@ -1036,9 +1036,9 @@ sub remove_empty {
sub get_file_contents { sub get_file_contents {
my $file = shift; my $file = shift;
open( FH, "< $file" ) or die "Can't open $file for read: $!"; open(my $fh, "<", $file) or die "Can't open $file for read: $!";
my @lines = <FH>; my @lines = <$fh>;
close FH or die "Cannot close $file: $!"; close $fh or die "Cannot close $file: $!";
remove_cr \@lines; remove_cr \@lines;
return @lines; return @lines;
} }
@ -1056,8 +1056,8 @@ sub cve_recommendations {
#prettyprint "Look for related CVE for $myvar{'version'} or lower in $opt{cvefile}"; #prettyprint "Look for related CVE for $myvar{'version'} or lower in $opt{cvefile}";
my $cvefound = 0; my $cvefound = 0;
open( FH, "<$opt{cvefile}" ) or die "Can't open $opt{cvefile} for read: $!"; open(my $fh, "<", $opt{cvefile}) or die "Can't open $opt{cvefile} for read: $!";
while ( my $cveline = <FH> ) { while ( my $cveline = <$fh> ) {
my @cve = split( ';', $cveline ); my @cve = split( ';', $cveline );
debugprint "Comparing $mysqlvermajor\.$mysqlverminor\.$mysqlvermicro with $cve[1]\.$cve[2]\.$cve[3] : ".(mysql_version_le( $cve[1], $cve[2], $cve[3] )?'<=':'>'); debugprint "Comparing $mysqlvermajor\.$mysqlverminor\.$mysqlvermicro with $cve[1]\.$cve[2]\.$cve[3] : ".(mysql_version_le( $cve[1], $cve[2], $cve[3] )?'<=':'>');
@ -1069,7 +1069,7 @@ sub cve_recommendations {
$cvefound++; $cvefound++;
} }
} }
close FH or die "Cannot close $opt{cvefile}: $!"; close $fh or die "Cannot close $opt{cvefile}: $!";
$result{'CVE'}{'nb'}=$cvefound; $result{'CVE'}{'nb'}=$cvefound;
if ( $cvefound == 0 ) { if ( $cvefound == 0 ) {
goodprint "NO SECURITY CVE FOUND FOR YOUR VERSION"; goodprint "NO SECURITY CVE FOUND FOR YOUR VERSION";