aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2018-05-23 20:04:08 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-06-29 19:38:23 +0200
commitdd8c713ff276be76bd7717ab0bbfbeebe570caaa (patch)
tree66d6187df687c0df3c1d41f14c8daec7000ee312
parent75ae498dd19d5a10945421d69ae86c0a16f109c8 (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 334b586..cd3d507 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);