From: Remi Gacogne Date: Tue, 23 Jan 2024 07:51:45 +0000 (+0100) Subject: dnsdist: Move the console socket instead of copying it X-Git-Tag: dnsdist-1.9.0-rc1~16^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F13735%2Fhead;p=thirdparty%2Fpdns.git dnsdist: Move the console socket instead of copying it Reported by Coverity as CID 414105. We don't really care about the performance impact but other tools are "helpfully" reporting this kind of missed optimizations, so let's not waste our time. --- diff --git a/pdns/dnsdist-lua.cc b/pdns/dnsdist-lua.cc index 09574e1df5..54b7109b19 100644 --- a/pdns/dnsdist-lua.cc +++ b/pdns/dnsdist-lua.cc @@ -1116,7 +1116,7 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck) auto sock = std::make_shared(local.sin4.sin_family, SOCK_STREAM, 0); sock->bind(local, true); sock->listen(5); - auto launch = [sock, local]() { + auto launch = [sock = std::move(sock), local]() { std::thread consoleControlThread(controlThread, sock, local); consoleControlThread.detach(); };