From f41e684e9a38107cb4c12d1a974162bd0951998c Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Tue, 3 Mar 2026 08:45:27 +0100 Subject: [PATCH] BUG/MINOR: hlua: fix return with push nil on proxy check hlua_check_proxy() may now return NULL if the target proxy instance has been flagged for deletion. Thus, proxies method have been adjusted and may push nil to report such case. This patch fixes these error paths. When nil is pushed, 1 must be returned instead of 0. This represents the count of pushed values on the stack which can be retrieved by the caller. No need to backport. --- src/hlua_fcn.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/hlua_fcn.c b/src/hlua_fcn.c index ed374e24a..36c5f98d0 100644 --- a/src/hlua_fcn.c +++ b/src/hlua_fcn.c @@ -1988,7 +1988,7 @@ int hlua_proxy_get_name(lua_State *L) px = hlua_check_proxy(L, 1); if (px == NULL) { lua_pushnil(L); - return 0; + return 1; } lua_pushstring(L, px->id); @@ -2003,7 +2003,7 @@ int hlua_proxy_get_uuid(lua_State *L) px = hlua_check_proxy(L, 1); if (px == NULL) { lua_pushnil(L); - return 0; + return 1; } snprintf(buffer, sizeof(buffer), "%d", px->uuid); @@ -2086,7 +2086,7 @@ int hlua_proxy_get_cap(lua_State *L) px = hlua_check_proxy(L, 1); if (px == NULL) { lua_pushnil(L); - return 0; + return 1; } str = proxy_cap_str(px->cap); @@ -2102,7 +2102,7 @@ int hlua_proxy_get_stats(lua_State *L) px = hlua_check_proxy(L, 1); if (px == NULL) { lua_pushnil(L); - return 0; + return 1; } if (px->cap & PR_CAP_BE) @@ -2127,7 +2127,7 @@ int hlua_proxy_get_mode(lua_State *L) px = hlua_check_proxy(L, 1); if (px == NULL) { lua_pushnil(L); - return 0; + return 1; } str = proxy_mode_str(px->mode); @@ -2154,7 +2154,7 @@ int hlua_proxy_get_srv_act(lua_State *L) px = hlua_check_proxy(L, 1); if (px == NULL) { lua_pushnil(L); - return 0; + return 1; } lua_pushinteger(L, px->srv_act); @@ -2168,7 +2168,7 @@ int hlua_proxy_get_srv_bck(lua_State *L) px = hlua_check_proxy(L, 1); if (px == NULL) { lua_pushnil(L); - return 0; + return 1; } lua_pushinteger(L, px->srv_bck); @@ -2187,7 +2187,7 @@ int hlua_proxy_get_mailers(lua_State *L) px = hlua_check_proxy(L, 1); if (px == NULL) { lua_pushnil(L); - return 0; + return 1; } if (!px->email_alert.mailers.m)