From 554b5ec5cbe4520abfee59ac0963af7ac1ecfadd Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Tue, 19 Dec 2017 16:26:34 +0100 Subject: Add binding rootdir to searched path for conf and plugins Change-Id: I4526dd9afc76ac9c63ecb6e800157a0678485955 Signed-off-by: Romain Forlot --- ctl-lib/ctl-plugin.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'ctl-lib/ctl-plugin.c') 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); -- cgit 1.2.3-korg