[ubus] [PATCH 1/2] lua: Use local state in ubus_lua_add()
Ernestas Kulik
ernestas.k at iconn-networks.com
Thu Jan 2 04:48:31 PST 2025
Currently, when setting __ubusobj on the table passed to ubus_lua_add(),
the global state is used. It’s not immediately apparent that it’s
intentional, so this commit changes the Lua calls to use function-local
state.
Signed-off-by: Ernestas Kulik <ernestas.k at iconn-networks.com>
---
lua/ubus.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lua/ubus.c b/lua/ubus.c
index 07b816d..cf2b555 100644
--- a/lua/ubus.c
+++ b/lua/ubus.c
@@ -577,9 +577,9 @@ static int ubus_lua_add(lua_State *L)
ubus_add_object(c->ctx, obj);
/* allow future reference of ubus obj */
- lua_pushstring(state,"__ubusobj");
- lua_pushlightuserdata(state, obj);
- lua_settable(state,-3);
+ lua_pushstring(L,"__ubusobj");
+ lua_pushlightuserdata(L, obj);
+ lua_settable(L,-3);
}
}
lua_pop(L, 1);
--
2.45.2
More information about the openwrt-devel
mailing list