diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2018-08-03 15:54:58 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2018-12-13 15:02:55 +0100 |
commit | 616b975b75f13ff60818c915d8691118f3157d9e (patch) | |
tree | 1b8a67a9c59496b84055db92c03702a53d91a526 /ctl-lib | |
parent | 5e3f2864f8dc0c97511bf665cb61914fcf945be5 (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')
-rw-r--r-- | ctl-lib/ctl-lua.c | 5 |
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++) { |