summaryrefslogtreecommitdiffstats
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-12-13 15:02:55 +0100
commitf395cd8e001bada80ae96526f89827984119c807 (patch)
treee702106308a1f8811431abc316b8aa6af8216d6e
parent418132ed1b25d2bc6b200f265766ced8c0fb9764 (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;
}