aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-06-29 19:35:24 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-06-29 19:38:23 +0200
commit169992d18a1d0de4e290f1d5ac2887113e6cac65 (patch)
tree17893250d9a3a825dde8e69ce11745cae60bd069
parentcf1a7ea2bba1e0f2cc0d958148a1d488508c1a03 (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 2bbae73..fd55e87 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;
}