Cleaned up code and changed function structure.

This commit is contained in:
Markus Makela
2015-08-27 16:33:10 +03:00
parent 296bdc5df6
commit c5214bea1b
4 changed files with 18 additions and 18 deletions

View File

@ -92,7 +92,7 @@ static void global_defaults();
static void feedback_defaults();
static void check_config_objects(CONFIG_CONTEXT *context);
int config_truth_value(char *str);
int isInternalService(char *router);
bool isInternalService(char *router);
int config_get_ifaddr(unsigned char *output);
int config_get_release_string(char* release);
FEEDBACK_CONF * config_get_feedback_data();
@ -898,7 +898,7 @@ process_config_context(CONFIG_CONTEXT *context)
s = strtok_r(NULL, ",", &lasts);
}
}
else if (servers == NULL && isInternalService(router) == 0)
else if (servers == NULL && !isInternalService(router))
{
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
@ -2230,18 +2230,16 @@ static char *InternalRouters[] = {
* @param router The router name
* @return Non-zero if the router is in the InternalRouters table
*/
int
bool
isInternalService(char *router)
{
int i;
if (router)
{
for (i = 0; InternalRouters[i]; i++)
for (int i = 0; InternalRouters[i]; i++)
if (strcmp(router, InternalRouters[i]) == 0)
return 1;
return true;
}
return 0;
return false;
}
/**
* Get the MAC address of first network interface

View File

@ -2387,7 +2387,6 @@ bool check_service_permissions(SERVICE* service)
skygw_log_write(LE,"%s: Error: User '%s' is missing SELECT privileges"
" on mysql.user table. MySQL error message: %s",
service->name,user,mysql_error(mysql));
rval = false;
}
else
{
@ -2395,6 +2394,7 @@ bool check_service_permissions(SERVICE* service)
" MySQL error message: %s",
service->name,mysql_error(mysql));
}
rval = false;
}
else
{
@ -2405,7 +2405,7 @@ bool check_service_permissions(SERVICE* service)
service->name,mysql_error(mysql));
mysql_close(mysql);
free(dpasswd);
return rval;
return false;
}
mysql_free_result(res);
@ -2416,13 +2416,13 @@ bool check_service_permissions(SERVICE* service)
{
skygw_log_write(LE,"%s: Error: User '%s' is missing SELECT privileges on mysql.db table. MySQL error message: %s",
service->name,user,mysql_error(mysql));
rval = false;
}
else
{
skygw_log_write(LE,"%s: Error: Failed to query from mysql.db table. MySQL error message: %s",
service->name,mysql_error(mysql));
}
rval = false;
}
else
{
@ -2430,6 +2430,7 @@ bool check_service_permissions(SERVICE* service)
{
skygw_log_write(LE,"%s: Error: Result retrieval failed when checking for permissions to the mysql.db table: %s",
service->name,mysql_error(mysql));
rval = false;
}
else
{

View File

@ -493,7 +493,7 @@ bool check_monitor_permissions(MONITOR* monitor)
server->port);
mysql_close(mysql);
free(dpasswd);
return true;
return false;
}
if(mysql_query(mysql,"show slave status") != 0)
@ -502,13 +502,13 @@ bool check_monitor_permissions(MONITOR* monitor)
{
skygw_log_write(LE,"%s: Error: User '%s' is missing REPLICATION CLIENT privileges. MySQL error message: %s",
monitor->name,user,mysql_error(mysql));
rval = false;
}
else
{
skygw_log_write(LE,"%s: Error: Monitor failed to query for slave status. MySQL error message: %s",
monitor->name,mysql_error(mysql));
}
rval = false;
}
else
{
@ -516,12 +516,13 @@ bool check_monitor_permissions(MONITOR* monitor)
{
skygw_log_write(LE,"%s: Error: Result retrieval failed when checking for REPLICATION CLIENT permissions: %s",
monitor->name,mysql_error(mysql));
free(dpasswd);
mysql_close(mysql);
return rval;
rval = false;
}
else
{
mysql_free_result(res);
}
}
mysql_close(mysql);
free(dpasswd);
return rval;

View File

@ -146,5 +146,5 @@ void config_enable_feedback_task(void);
void config_disable_feedback_task(void);
unsigned long config_get_gateway_id(void);
GATEWAY_CONF* config_get_global_options();
int isInternalService(char *router);
bool isInternalService(char *router);
#endif