From f395cd8e001bada80ae96526f89827984119c807 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Fri, 29 Jun 2018 19:35:24 +0200 Subject: 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 --- ctl-lib/ctl-plugin.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ctl-lib') 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; } -- cgit 1.2.3-korg