From: Remi Gacogne Date: Thu, 20 May 2021 07:29:00 +0000 (+0200) Subject: auth: Only the call to mysql_init() needs to be protected by a mutex X-Git-Tag: dnsdist-1.7.0-alpha1~11^2~18 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f99fe259f3e831f1be4c57be321814806c8308fc;p=thirdparty%2Fpdns.git auth: Only the call to mysql_init() needs to be protected by a mutex --- diff --git a/modules/gmysqlbackend/smysql.cc b/modules/gmysqlbackend/smysql.cc index 35267c9e58..b3ce048f19 100644 --- a/modules/gmysqlbackend/smysql.cc +++ b/modules/gmysqlbackend/smysql.cc @@ -476,13 +476,16 @@ void SMySQL::connect() { int retry = 1; - std::lock_guard l(s_myinitlock); - if (d_threadCleanup) { - threadcloser.enable(); - } + { + std::lock_guard l(s_myinitlock); + if (d_threadCleanup) { + threadcloser.enable(); + } - if (!mysql_init(&d_db)) - throw sPerrorException("Unable to initialize mysql driver"); + if (!mysql_init(&d_db)) { + throw sPerrorException("Unable to initialize mysql driver"); + } + } do {