From dfc37699ea86f76c4010b3041d5b44fc5591501d Mon Sep 17 00:00:00 2001 From: Yannick Gicquel Date: Thu, 28 Jan 2016 16:31:50 +0100 Subject: rest-api: catch error from pluginRegisterFct() in case NULL is returned, log an error and do not register the plugin. Signed-off-by: Yannick Gicquel --- src/rest-api.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/rest-api.c b/src/rest-api.c index e1c3756c..eae1d63c 100644 --- a/src/rest-api.c +++ b/src/rest-api.c @@ -637,8 +637,10 @@ STATIC void scanDirectory(char *dirpath, int dirfd, AFB_plugin **plugins, int *c if (verbose) fprintf(stderr, "[%s] is a valid AFB plugin, loading pos[%d]\n", pluginDir.d_name, *count); plugins[*count] = pluginRegisterFct(); - *count = *count +1; - + if (!plugins[*count]) { + if (verbose) fprintf(stderr, "ERROR: plugin [%s] register function failed. continuing...\n", pluginDir.d_name); + } else + *count = *count +1; } } closedir (dir); -- cgit 1.2.3-korg