From c2b4098afc0552b2430362a10ba0bb46a2fc2c14 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Fri, 8 Dec 2023 16:59:30 +0100 Subject: [PATCH] dnsdist: Apply Otto's suggestion for the qtypeForAny parameter --- pdns/dnsdist-lua-actions.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pdns/dnsdist-lua-actions.cc b/pdns/dnsdist-lua-actions.cc index 66c2889bcf..5aa994a1a6 100644 --- a/pdns/dnsdist-lua-actions.cc +++ b/pdns/dnsdist-lua-actions.cc @@ -2510,7 +2510,11 @@ void setupLuaActions(LuaContext& luaCtx) if (qtypeForAny > std::numeric_limits::max()) { qtypeForAny = 0; } - auto ret = std::shared_ptr(new SpoofAction(raws, qtypeForAny > 0 ? static_cast(qtypeForAny) : std::optional())); + std::optional qtypeForAnyParam; + if (qtypeForAny > 0) { + qtypeForAnyParam = static_cast(qtypeForAny); + } + auto ret = std::shared_ptr(new SpoofAction(raws, qtypeForAnyParam)); auto sa = std::dynamic_pointer_cast(ret); parseResponseConfig(vars, sa->d_responseConfig); checkAllParametersConsumed("SpoofRawAction", vars); -- 2.47.2