diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2018-07-26 12:27:30 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2018-08-02 16:50:49 +0200 |
commit | 3487157e3c71f089d9ff4ff555a893f2cdb066a3 (patch) | |
tree | 7025d728425074f17c5da784ac8f6da86fb8f8f0 /src/aft.c | |
parent | 408e027948eecc80c9c05b8b0e30825b33c73279 (diff) |
Add the binding root dir to the config search path
Change-Id: Ia067ce46f13bc49b6050522d0484f92627968ff1
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src/aft.c')
-rw-r--r-- | src/aft.c | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -190,22 +190,27 @@ static int CtrlCreateApi(AFB_ApiT apiHandle, CtlConfigT *ctrlConfig) { } int afbBindingEntry(afb_api_t apiHandle) { - size_t len = 0; + size_t len = 0, bindingRootDirLen = 0; char *dirList; - const char *envDirList = NULL, *configPath = NULL; + const char *envDirList = NULL, *configPath = NULL, *bindingRootDir = NULL; AFB_default = apiHandle; AFB_ApiDebug(apiHandle, "Controller in afbBindingEntry"); envDirList = getEnvDirList(CONTROL_PREFIX, "CONFIG_PATH"); + bindingRootDir = GetBindingDirPath(); + bindingRootDirLen = strlen(bindingRootDir); + if(envDirList) { - len = strlen(CONTROL_CONFIG_PATH) + strlen(envDirList); + len = strlen(CONTROL_CONFIG_PATH) + strlen(envDirList) + bindingRootDirLen; dirList = malloc(len + 1); - snprintf(dirList, len + 1, "%s:%s", envDirList, CONTROL_CONFIG_PATH); + snprintf(dirList, len + 2, "%s:%s:%s", envDirList, bindingRootDir, CONTROL_CONFIG_PATH); } else { - dirList = CONTROL_CONFIG_PATH; + len = strlen(CONTROL_CONFIG_PATH) + bindingRootDirLen; + dirList = malloc(len + 1); + snprintf(dirList, len + 1, "%s:%s", bindingRootDir, CONTROL_CONFIG_PATH); } configPath = CtlConfigSearch(apiHandle, dirList, CONTROL_PREFIX); |