From 996fd9d2545ea7c4971e0b430d1140d9d6bd1cc0 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Tue, 12 Apr 2022 15:41:48 +0200 Subject: [PATCH] dnsdist: Reuse the temporary logging string for syslog --- pdns/dolog.hh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pdns/dolog.hh b/pdns/dolog.hh index 3c5237a5bd..638db32aa9 100644 --- a/pdns/dolog.hh +++ b/pdns/dolog.hh @@ -93,8 +93,11 @@ void genlog(int level, const char* s, Args... args) std::ostringstream str; dolog(str, s, args...); - if(g_syslog) - syslog(level, "%s", str.str().c_str()); + auto output = str.str(); + + if (g_syslog) { + syslog(level, "%s", output.c_str()); + } #ifdef DNSDIST if (g_logtimestamps) { @@ -110,7 +113,7 @@ void genlog(int level, const char* s, Args... args) } #endif - std::cout<