From bbd0a68b8f86ac6514a7b644892464c394c560bf Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sat, 9 May 2026 11:50:10 +0800 Subject: [PATCH] rgw: fix build with Lua 5.5 Lua 5.5 added a `seed` parameter to `lua_newstate()`. Use a preprocessor conditional to pass the extra argument when building against Lua >= 5.5. Since we require Lua >= 5.3 in src/CMakeLists.txt, we need to be compatible with Lua 5.5 as well. See https://www.lua.org/manual/5.5/manual.html#lua_newstate Signed-off-by: Kefu Chai --- src/rgw/rgw_lua_utils.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/rgw/rgw_lua_utils.cc b/src/rgw/rgw_lua_utils.cc index 0b73e6aa14a6..82ee7d25fcd3 100644 --- a/src/rgw/rgw_lua_utils.cc +++ b/src/rgw/rgw_lua_utils.cc @@ -117,7 +117,11 @@ void* allocator(void* ud, void* ptr, std::size_t osize, std::size_t nsize) { // create new lua state together with reference to the guard lua_State* newstate(lua_state_guard* guard) { +#if LUA_VERSION_NUM >= 505 + lua_State* L = lua_newstate(allocator, guard, 0); +#else lua_State* L = lua_newstate(allocator, guard); +#endif if (L) { lua_atpanic(L, [](lua_State* L) -> int { const char* msg = lua_tostring(L, -1); -- 2.47.3