]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-lua: Do not expect return value from script_init()
authorAki Tuomi <aki.tuomi@open-xchange.com>
Mon, 15 May 2023 06:23:31 +0000 (09:23 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 19 May 2023 09:25:44 +0000 (09:25 +0000)
This is not really needed. Script can call error() if
they need to fail.

src/lib-lua/dlua-script.c

index 487d02466a987b637b848ac3f39cfd941b34a08a..63025d0b1b5e521f04baa08b6baf203b8e4bc413 100644 (file)
@@ -174,22 +174,9 @@ int dlua_script_init(struct dlua_script *script, const char **error_r)
 
        int ret = 0;
 
-       if (dlua_pcall(script->L, LUA_SCRIPT_INIT_FN, 0, 1, error_r) < 0)
+       if (dlua_pcall(script->L, LUA_SCRIPT_INIT_FN, 0, 0, error_r) < 0)
                return -1;
 
-       if (lua_isinteger(script->L, -1)) {
-               ret = lua_tointeger(script->L, -1);
-               if (ret != 0) {
-                       *error_r = "Script init failed";
-                       ret = -1;
-               }
-       } else {
-               *error_r = LUA_SCRIPT_INIT_FN"() returned non-number";
-               ret = -1;
-       }
-
-       lua_pop(script->L, 1);
-
        i_assert(lua_gettop(script->L) == 0);
        return ret;
 }