Determine real log_error path.

Determines real log_error path if mysql variable not set or file
is relative and does not exist in current working directory.
Otherwise return back original value.
This commit is contained in:
Thomas Meyer 2017-09-24 05:45:13 -07:00
parent 7f83318d49
commit c45ac0925d

View file

@ -1148,7 +1148,26 @@ sub get_basic_passwords {
return get_file_contents(shift);
}
sub get_log_file_real_path {
my $file = shift;
my $hostname = shift;
my $datadir = shift;
if ( -f "$file" ) {
return $file;
}
elsif ( -f "$hostname.err" ) {
return "$hostname.err"
}
elsif ( $datadir ne "" ) {
return "$datadir$hostname.err";
}
else {
return $file;
}
}
sub log_file_recommandations {
$myvar{'log_error'} = get_log_file_real_path( $myvar{'log_error'}, $myvar{'hostname'}, $myvar{'datadir'} );
subheaderprint "Log file Recommendations";
infoprint "Log file: "
. $myvar{'log_error'} . "("