]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix build with Lua 5.5 68833/head
authorKefu Chai <k.chai@proxmox.com>
Sat, 9 May 2026 03:50:10 +0000 (11:50 +0800)
committerKefu Chai <k.chai@proxmox.com>
Sat, 9 May 2026 05:14:25 +0000 (13:14 +0800)
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 <k.chai@proxmox.com>
src/rgw/rgw_lua_utils.cc

index 0b73e6aa14a69eb757283f6c30c0d9b6fddebe4a..82ee7d25fcd30924970a8e4c9444270bd0a9c7c2 100644 (file)
@@ -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);