From 8f33b55fea52f2d7b93114c57b88a1ce94091264 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 30 Aug 2016 13:34:52 +0200 Subject: [PATCH] #242 initiliaze $data_free to 0 if not defined or is empty --- mysqltuner.pl | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/mysqltuner.pl b/mysqltuner.pl index b8f5e4e..b5b8053 100755 --- a/mysqltuner.pl +++ b/mysqltuner.pl @@ -30,7 +30,7 @@ # Everett Barnes Tom Krouper Gary Barrueto # Simon Greenaway Adam Stein Isart Montane # Baptiste M. Cole Turner Major Hayden -# Joe Ashcraft Jean-Marie Renouard +# Joe Ashcraft Jean-Marie Renouard Christian Loos # # Inspired by Matthew Montgomery's tuning-primer.sh script: # http://forge.mysql.com/projects/view.php?id=44 @@ -72,6 +72,7 @@ my %opt = ( "port" => 0, "user" => 0, "pass" => 0, + "password" => 0, "skipsize" => 0, "checkversion" => 0, "updateversion" => 0, @@ -111,7 +112,8 @@ my $getOptionsCheck = GetOptions( 'template=s', 'reportfile=s', 'cvefile=s', 'bannedports=s', 'updateversion', 'maxportallowed=s', - 'verbose', 'sysstat' + 'verbose', 'sysstat', + 'password=s', ); #If params are incorrect return help @@ -182,6 +184,9 @@ my $basic_password_files = ? abs_path( dirname(__FILE__) ) . "/basic_passwords.txt" : abs_path( $opt{passwordfile} ); +# Related to password option +$opt{pass}=$opt{password} if ($opt{pass} eq 0 and $opt{password} ne 0); + # for RPM distributions $basic_password_files = "/usr/share/mysqltuner/basic_passwords.txt" unless -f "$basic_password_files"; @@ -1907,6 +1912,7 @@ sub check_storage_engines { my $total_free=0; foreach my $table_line (@{$result{'Tables'}{'Fragmented tables'}}) { my ($table_name,$data_free)=split(/\s+/,$table_line); + $data_free=0 unless defined($data_free) or $data_free == ''; $data_free=$data_free/1024/1024; $total_free+=$data_free; push( @generalrec, @@ -4327,6 +4333,10 @@ Jean-Marie Renouard Stephan GroBberndt +=item * + +Christian Loos + =back =head1 SUPPORT