diff options
author | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2018-05-23 20:04:08 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2018-12-13 15:02:54 +0100 |
commit | f6b6f947c0ce8d7e57783e3ac03ab9c7932620bb (patch) | |
tree | 0016948e34327c14bc48976c65125054edaec263 /ctl-lib | |
parent | d0253b51ca38dde4358446edf92e2baeafa5f12f (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>
Diffstat (limited to 'ctl-lib')
-rw-r--r-- | ctl-lib/ctl-config.c | 2 |
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); |