aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-06-29 19:35:24 +0200
committerStéphane Desneux <stephane.desneux@iot.bzh>2018-07-03 14:42:47 +0000
commit2d1c3d2dcd47b13497ef7d0d85f3fc8d90d1b9c5 (patch)
treee702106308a1f8811431abc316b8aa6af8216d6e
parent96221381647127814bbf593856622af1816df3e9 (diff)
Always set the api member even if NULL.
This should fix case where plugin doesn't have an onload section but need to set the apihandle to be able to use it later. Change-Id: I07d4d38ce236732575d97a3c0a01cb03acad255a Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--ctl-lib/ctl-plugin.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ctl-lib/ctl-plugin.c b/ctl-lib/ctl-plugin.c
index 26f9991..f36c82c 100644
--- a/ctl-lib/ctl-plugin.c
+++ b/ctl-lib/ctl-plugin.c
@@ -177,13 +177,14 @@ static int PluginLoadCOne(AFB_ApiT apiHandle, const char *pluginpath, json_objec
#endif
DispatchPluginInstallCbT ctlPluginOnload = dlsym(dlHandle, "CtlPluginOnload");
if (ctlPluginOnload) {
- ctlPlugin->api = apiHandle;
if((*ctlPluginOnload) (ctlPlugin, handle)) {
AFB_ApiError(apiHandle, "Plugin Onload function hasn't finish well. Abort initialization");
return -1;
}
}
+ ctlPlugin->api = apiHandle;
+
return 0;
}