diff mbox series

Lua: do not inject again bootenv for handlers

Message ID 20240703130816.433514-1-stefano.babic@swupdate.org
State Changes Requested
Headers show
Series Lua: do not inject again bootenv for handlers | expand

Commit Message

Stefano Babic July 3, 2024, 1:08 p.m. UTC
Boot environment is pushed to Lua stack to let it available to Lua
handlers. After moving Lua state to be per session and added the
environment whe nthe session is initialized, there is no need to do this
another time.

Signed-off-by: Stefano Babic <stefano.babic@swupdate.org>
---
 corelib/lua_interface.c | 11 -----------
 1 file changed, 11 deletions(-)

--
2.34.1
diff mbox series

Patch

diff --git a/corelib/lua_interface.c b/corelib/lua_interface.c
index 86c2112d..ffa3af8c 100644
--- a/corelib/lua_interface.c
+++ b/corelib/lua_interface.c
@@ -1307,17 +1307,6 @@  static int l_handler_wrapper(struct img_type *img, void *data,
 		return -1;
 	}

-	if (img->bootloader) {
-		lua_getglobal(L, "swupdate");
-		if (!lua_istable(L, -1)) {
-			ERROR("Lua stack corrupted.");
-			return -1;
-		}
-		struct dict **udbootenv = lua_newuserdata(L, sizeof(struct dict*));
-		*udbootenv = img->bootloader;
-		lua_pop(L, 1);
-	}
-
 	l_func_ref = *((int*)data);
 	/* get the callback function */
 	lua_rawgeti(L, LUA_REGISTRYINDEX, l_func_ref );