summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDonald Lee <dlqs@gmx.com>2021-07-23 21:34:28 +0200
committerDonald Lee <dlqs@gmx.com>2021-07-23 21:40:57 +0200
commit4093300ee891bd7559b93e2b7c94fb6fc68b5ddc (patch)
treee9166cca8ccdc4d7603bb6d375cb91f9ee04bfb4
parentlib: comment typo (diff)
downloadfrr-4093300ee891bd7559b93e2b7c94fb6fc68b5ddc.tar.xz
frr-4093300ee891bd7559b93e2b7c94fb6fc68b5ddc.zip
lib: zlog err in error cases during lua loading
Signed-off-by: Donald Lee <dlqs@gmx.com>
-rw-r--r--lib/frrscript.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/frrscript.c b/lib/frrscript.c
index 8fe8a93f0..59fce36c7 100644
--- a/lib/frrscript.c
+++ b/lib/frrscript.c
@@ -317,11 +317,18 @@ int frrscript_load(struct frrscript *fs, const char *function_name,
/* Push the Lua function we want */
lua_getglobal(L, function_name);
- if (lua_isfunction(L, lua_gettop(L)) == 0)
+ if (lua_isfunction(L, lua_gettop(L)) == 0) {
+ zlog_err("frrscript: loaded script '%s.lua' but %s not found",
+ script_name, function_name);
goto fail;
+ }
- if (load_cb && (*load_cb)(fs) != 0)
+ if (load_cb && (*load_cb)(fs) != 0) {
+ zlog_err(
+ "frrscript: '%s.lua': %s: loaded but callback returned non-zero exit code",
+ script_name, function_name);
goto fail;
+ }
/* Add the Lua function state to frrscript */
struct lua_function_state key = {.name = function_name, .L = L};