summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYannick Gicquel <yannick.gicquel@iot.bzh>2016-01-28 16:31:50 +0100
committerYannick Gicquel <yannick.gicquel@iot.bzh>2016-01-28 16:31:50 +0100
commitdfc37699ea86f76c4010b3041d5b44fc5591501d (patch)
treed9dab2caa70213c0669c5fe12c34564f849cd129
parenta4b35de73384d4394b5201838c1c785355d9a7fd (diff)
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 <yannick.gicquel@iot.bzh>
-rw-r--r--src/rest-api.c6
1 files 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);