summaryrefslogtreecommitdiffstats
path: root/ctl-lib/ctl-plugin.c
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-12-19 16:26:34 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2018-12-13 15:02:54 +0100
commit111d47a27016ea98007998d21fd07498e9bd4a01 (patch)
tree8ff5a33034c0e954592b28005e077e7d30a63063 /ctl-lib/ctl-plugin.c
parentbdaad7f84e6f60d7ca1561e8acc5e7d834914153 (diff)
Add binding rootdir to searched path for conf and plugins
Change-Id: I4526dd9afc76ac9c63ecb6e800157a0678485955 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'ctl-lib/ctl-plugin.c')
-rw-r--r--ctl-lib/ctl-plugin.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/ctl-lib/ctl-plugin.c b/ctl-lib/ctl-plugin.c
index 5677f91..705a2b4 100644
--- a/ctl-lib/ctl-plugin.c
+++ b/ctl-lib/ctl-plugin.c
@@ -108,7 +108,19 @@ STATIC int PluginLoadOne (AFB_ApiT apiHandle, CtlPluginT *ctlPlugin, json_object
if (!basename) basename=ctlPlugin->uid;
// if search path not in Json config file, then try default
- if (!ldSearchPath) ldSearchPath = CONTROL_PLUGIN_PATH;
+ if (!ldSearchPath)
+ {
+ char path[CONTROL_MAXPATH_LEN];
+ memset(path, 0, sizeof(path));
+ const char *envpath = getenv("CONTROL_PLUGIN_PATH");
+ envpath ?
+ strncat(path, envpath, strlen(envpath)):
+ strncat(path, CONTROL_PLUGIN_PATH, strlen(CONTROL_PLUGIN_PATH));
+ const char *bPath = GetBindingDirPath();
+ strncat(path, ":", strlen(":"));
+ strncat(path, bPath, strlen(bPath));
+ ldSearchPath = path;
+ }
// search for default policy config file
pluginPathJ = ScanForConfig(ldSearchPath, CTL_SCAN_RECURSIVE, basename, CTL_PLUGIN_EXT);