Fix to MXS-342: https://mariadb.atlassian.net/browse/MXS-342
Added more error messaging when the parsing of the configuration file fails.
This commit is contained in:
@ -1055,6 +1055,7 @@ int main(int argc, char **argv)
|
||||
int l;
|
||||
int i;
|
||||
int n;
|
||||
int ini_rval;
|
||||
intptr_t thread_id;
|
||||
int n_threads; /*< number of epoll listener threads */
|
||||
int n_services;
|
||||
@ -1591,8 +1592,27 @@ int main(int argc, char **argv)
|
||||
goto return_main;
|
||||
}
|
||||
|
||||
if(ini_parse(cnf_file_path,cnf_preparser,NULL) != 0)
|
||||
if((ini_rval = ini_parse(cnf_file_path,cnf_preparser,NULL)) != 0)
|
||||
{
|
||||
char errorbuffer[STRING_BUFFER_SIZE + 1];
|
||||
|
||||
if(ini_rval > 0)
|
||||
snprintf(errorbuffer, STRING_BUFFER_SIZE,
|
||||
"Error: Failed to pre-parse configuration file. Error on line %d.", ini_rval);
|
||||
else if(ini_rval == -1)
|
||||
snprintf(errorbuffer, STRING_BUFFER_SIZE,
|
||||
"Error: Failed to pre-parse configuration file. Failed to open file.");
|
||||
else
|
||||
snprintf(errorbuffer, STRING_BUFFER_SIZE,
|
||||
"Error: Failed to pre-parse configuration file. Memory allocation failed.");
|
||||
|
||||
skygw_log_write(LE, errorbuffer);
|
||||
if(!daemon_mode)
|
||||
{
|
||||
strncat(errorbuffer,"\n",STRING_BUFFER_SIZE);
|
||||
fprintf(stderr, errorbuffer);
|
||||
}
|
||||
|
||||
rc = MAXSCALE_BADCONFIG;
|
||||
goto return_main;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user