From 8b51d4fee2fb48abe724d9bcccd7505c13fc5283 Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Tue, 9 Dec 2014 06:31:53 +0200 Subject: [PATCH] Fix to bug 640: http://bugs.mariadb.com/show_bug.cgi?id=640 Added a check for the case when createInstance returns NULL. Added messages to error log if router instance creation fails or if the service fails to start for any reason. --- server/core/service.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/server/core/service.c b/server/core/service.c index 4ef101085..3b08f4274 100644 --- a/server/core/service.c +++ b/server/core/service.c @@ -349,8 +349,15 @@ serviceStart(SERVICE *service) SERV_PROTOCOL *port; int listeners = 0; - service->router_instance = service->router->createInstance(service, - service->routerOptions); + if((service->router_instance = service->router->createInstance(service, + service->routerOptions)) == NULL) + { + LOGIF(LE, (skygw_log_write( + LOGFILE_ERROR, + "Error : Failed to start router for service '%s'.", + service->name))); + return listeners; + } port = service->ports; while (port) @@ -395,12 +402,21 @@ int serviceStartAll() { SERVICE *ptr; -int n = 0; +int n = 0,i; ptr = allServices; while (ptr) { - n += serviceStart(ptr); + n += (i = serviceStart(ptr)); + + if(i == 0) + { + LOGIF(LE, (skygw_log_write( + LOGFILE_ERROR, + "Error : Failed to start service '%s'.", + ptr->name))); + } + ptr = ptr->next; } return n;