aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2018-07-02 19:50:12 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-12-13 14:12:02 +0100
commite1936c3919ea56307cbdb60ccbd15cd0dcf80ba7 (patch)
tree5a3bb3cd37ede653b83b4ac19e76ee6e3d8ae53b
parentec2a978278b4b521e665e1f8c589a4b1f70fc889 (diff)
At search, use the prefix parameter as a prefix
Be sure that prefix parameter is used as a prefix when searching for configuration files (when using 'ScanForConfig' function). Before this change, the function was only checking that the prefix parameter was present in the file name (but not necessarily at the beginning of the file name). Bug-AGL:SPEC-1239 Change-Id: I9986cce5fab0fd5cd6d3049731f4c5883056a5f4 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
-rw-r--r--filescan-utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/filescan-utils.c b/filescan-utils.c
index 22af147..a6111c1 100644
--- a/filescan-utils.c
+++ b/filescan-utils.c
@@ -61,7 +61,7 @@ static int ScanDir(char* searchPath, CtlScanDirModeT mode, size_t extentionLen,
ssize_t extentionIdx = strlen(dirEnt->d_name) - extentionLen;
if (extentionIdx <= 0)
continue;
- if (prefix && !strcasestr(dirEnt->d_name, prefix))
+ if (prefix && strncasecmp(dirEnt->d_name, prefix, strlen(prefix)))
continue;
if (extention && strcasecmp(extention, &dirEnt->d_name[extentionIdx]))
continue;