Fix error detection in service creation

If a server that did not exist was added to the service, the error would
not cause a startup failure.
This commit is contained in:
Markus Mäkelä 2019-07-11 09:39:06 +03:00
parent 0394c9c525
commit 8c84a2b2a4
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -3734,12 +3734,11 @@ int create_new_service(CONFIG_CONTEXT* obj)
config_add_defaults(obj, config_service_params);
config_add_defaults(obj, module->parameters);
int error_count = 0;
Service* service = service_alloc(obj->object, router, obj->parameters);
if (service)
{
int error_count = 0;
for (auto& a : mxs::strtok(config_get_string(obj->parameters, CN_SERVERS), ","))
{
fix_object_name(a);
@ -3771,9 +3770,10 @@ int create_new_service(CONFIG_CONTEXT* obj)
else
{
MXS_ERROR("Service '%s' creation failed.", obj->object);
error_count++;
}
return service ? 0 : 1;
return error_count;
}
/**