From 472c489ae14835150b0b879b227b9f1dcc60791d Mon Sep 17 00:00:00 2001 From: Jan Vidar Krey Date: Tue, 16 Aug 2011 14:46:11 +0200 Subject: [PATCH] Fix bug #154 - plugin system is disabled silently if one plugin fails to initialize. --- src/core/hub.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/core/hub.c b/src/core/hub.c index 15e519c..75bc490 100644 --- a/src/core/hub.c +++ b/src/core/hub.c @@ -840,21 +840,22 @@ void hub_shutdown_service(struct hub_info* hub) } #ifdef PLUGIN_SUPPORT -void hub_plugins_load(struct hub_info* hub) +int hub_plugins_load(struct hub_info* hub) { if (!hub->config->file_plugins || !*hub->config->file_plugins) - return; + return 0; hub->plugins = hub_malloc_zero(sizeof(struct uhub_plugins)); if (!hub->plugins) - return; + return -1; if (plugin_initialize(hub->config, hub->plugins) < 0) { hub_free(hub->plugins); hub->plugins = 0; - return; + return -1; } + return 0; } void hub_plugins_unload(struct hub_info* hub) @@ -943,7 +944,11 @@ void hub_set_variables(struct hub_info* hub, struct acl_handle* acl) } #ifdef PLUGIN_SUPPORT - hub_plugins_load(hub); + if (hub_plugins_load(hub) < 0) + { + hub->status = hub_status_shutdown; + } + else #endif hub->status = (hub->config->hub_enabled ? hub_status_running : hub_status_disabled);