From f6b6f947c0ce8d7e57783e3ac03ab9c7932620bb Mon Sep 17 00:00:00 2001 From: Jonathan Aillet Date: Wed, 23 May 2018 20:04:08 +0200 Subject: 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 --- ctl-lib/ctl-config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ctl-lib/ctl-config.c') 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); -- cgit 1.2.3-korg