aboutsummaryrefslogtreecommitdiffstats
path: root/ctl-lib/ctl-lua.c
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-08-03 15:54:58 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-08-08 12:35:23 +0000
commite7132f1707e1a1bee15ed52b3550c4919048fe7b (patch)
tree1b8a67a9c59496b84055db92c03702a53d91a526 /ctl-lib/ctl-lua.c
parent36ed31c2f7ff6d5395a2efc5bebf3cda421568df (diff)
Change the default GLOB pattern
Change the default GLOB pattern because the lua should be found in var directory by default. Change-Id: I8be0e85c97459553e1d6a9f58efa394eb311a514 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'ctl-lib/ctl-lua.c')
-rw-r--r--ctl-lib/ctl-lua.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ctl-lib/ctl-lua.c b/ctl-lib/ctl-lua.c
index 67ef21a..9e4f791 100644
--- a/ctl-lib/ctl-lua.c
+++ b/ctl-lib/ctl-lua.c
@@ -35,7 +35,9 @@
#define LUA_MSG_MAX_LENGTH 2048
#define JSON_ERROR (json_object*)-1
#define LUA_PATH_VALUE "package.path = package.path .. ';?.lua;"
+#ifndef LUA_GLOB_PATTERN
#define LUA_GLOB_PATTERN "/?.lua;"
+#endif
static lua_State* luaState;
CtlPluginT *ctlPlugins = NULL;
@@ -1338,8 +1340,7 @@ int LuaConfigLoad(AFB_ApiT apiHandle, const char *prefix) {
sep++;
}
- // token + the lua glob pattern which is 7 char length
- total_len = base_len + spath_len + token_nb * 7 + 1;
+ total_len = base_len + spath_len + token_nb * strlen(LUA_GLOB_PATTERN) + 1;
lua_str = malloc(total_len + 1);
strncpy(lua_str, LUA_PATH_VALUE, total_len);
for (i = 0; i < token_nb; i++) {