aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-05-17 17:08:18 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-05-17 23:08:12 +0200
commitfe5acb095e578509111d50fe1abbf4c356875006 (patch)
treed4c41132ceb67f8fe4a72243c37929561142d5c7
parent71df9e17920283b8170bb65da98e279cb508e9b9 (diff)
Handle no prefix given
If no prefix given, then only use the binder name to search config file. Change-Id: I504ea27dccb8892e12e09d3e9e42bc281bcf87b0 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh> # Conflicts: # ctl-lib/ctl-config.c
-rw-r--r--ctl-lib/ctl-config.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/ctl-lib/ctl-config.c b/ctl-lib/ctl-config.c
index ce1e6fe..c99c3d6 100644
--- a/ctl-lib/ctl-config.c
+++ b/ctl-lib/ctl-config.c
@@ -48,9 +48,14 @@ int CtlConfigMagicNew() {
controlFile[CONTROL_MAXPATH_LEN - 1] = '\0';
- strncpy(controlFile, prefix, CONTROL_MAXPATH_LEN - 1);
- strncat(controlFile, binderName, CONTROL_MAXPATH_LEN - strlen(controlFile) - 1);
-
+ if(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);
+ }
+ else {
+ strncpy(controlFile, binderName, CONTROL_MAXPATH_LEN - 1);
+ }
// search for default dispatch config file
json_object* responseJ = ScanForConfig(dirList, CTL_SCAN_RECURSIVE, controlFile, ".json");