aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2018-05-23 20:04:08 +0200
committerJonathan Aillet <jonathan.aillet@iot.bzh>2018-05-28 09:55:58 +0200
commit53bc4e413c01d55318e8ddc27e526755cfad53a7 (patch)
tree0016948e34327c14bc48976c65125054edaec263
parent4a723022410de1a72b03a4901537af4e0d27397b (diff)
Add possibility to set prefix to NULL in CtlConfigScan
When prefix is set to NULL, only the middle name of the process will be used to find configuration files. Example: when the binder is named 'afb-4a-hal', and the prefix parameter is set to NULL, the 'CtlConfigScan' function will search for 4a-*.json config files in 'dirList' list. Change-Id: I8a9ee7df670d992f5461c865591ced9ba46fe8a0 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
-rw-r--r--ctl-lib/ctl-config.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ctl-lib/ctl-config.c b/ctl-lib/ctl-config.c
index de9f10e..f470255 100644
--- a/ctl-lib/ctl-config.c
+++ b/ctl-lib/ctl-config.c
@@ -48,7 +48,7 @@ json_object* CtlConfigScan(const char *dirList, const char *prefix) {
controlFile[CONTROL_MAXPATH_LEN - 1] = '\0';
- if(prefix[0] != '\0') {
+ if(prefix && prefix[0] != '\0') {
strncpy(controlFile, prefix, CONTROL_MAXPATH_LEN - 1);
strncat(controlFile, "-", CONTROL_MAXPATH_LEN - strlen(controlFile) - 1);
strncat(controlFile, binderName, CONTROL_MAXPATH_LEN - strlen(controlFile) - 1);