From 57db1e89a4dca62b55e5fc2e7af9592d5aefdd73 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Tue, 29 Aug 2017 10:47:16 +0200 Subject: Fix: set default value if missing defined var Change-Id: I93f8546e2cfe7fc11fdf0f956f10429f6c0ad8d0 Signed-off-by: Romain Forlot --- filescan-utils.c | 2 +- filescan-utils.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/filescan-utils.c b/filescan-utils.c index 46e461b..e735682 100644 --- a/filescan-utils.c +++ b/filescan-utils.c @@ -45,7 +45,7 @@ PUBLIC json_object* ScanForConfig (const char* searchPath, CtlScanDirModeT mode, // recursively search embedded directories ignoring any directory starting by '.' or '_' if (dirEnt->d_type == DT_DIR && mode == CTL_SCAN_RECURSIVE) { - char newpath[CONTROL_MAXPATH_LEN]; + char newpath[MAXPATH_LEN]; if (dirEnt->d_name[0]=='.' || dirEnt->d_name[0]=='_') continue; strncpy(newpath, searchPath, sizeof(newpath)); diff --git a/filescan-utils.h b/filescan-utils.h index a97d030..e0c5da1 100644 --- a/filescan-utils.h +++ b/filescan-utils.h @@ -31,6 +31,10 @@ #endif #define STATIC static +#ifndef MAXPATH_LEN + #define MAXPATH_LEN 255 +#endif + // ctl-misc.c typedef enum { CTL_SCAN_FLAT=0, -- cgit 1.2.3-korg