From: Otto Moerbeek Date: Mon, 17 Feb 2025 08:15:34 +0000 (+0100) Subject: This should eliminate a dozen or so Coverity warnigs X-Git-Tag: dnsdist-2.0.0-alpha1~82^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F15168%2Fhead;p=thirdparty%2Fpdns.git This should eliminate a dozen or so Coverity warnigs For example: 1591605 Data race condition 5. missing_lock: Accessing g_lowercaseOutgoing without holding lock LockGuarded, std::equal_to, std::allocator > > > >.d_mutex. Elsewhere, g_lowercaseOutgoing is written to with LockGuarded.d_mutex held 1 out of 1 times. --- diff --git a/pdns/recursordist/rec-main.cc b/pdns/recursordist/rec-main.cc index 0666317678..0e2a66a55f 100644 --- a/pdns/recursordist/rec-main.cc +++ b/pdns/recursordist/rec-main.cc @@ -2233,7 +2233,10 @@ static int serviceMain(Logr::log_t log) } g_networkTimeoutMsec = ::arg().asNum("network-timeout"); - std::tie(*g_initialDomainMap.lock(), *g_initialAllowNotifyFor.lock()) = parseZoneConfiguration(g_yamlSettings); + { // Reduce scope of locks (otherwise Coverity induces from this line the global vars below should be + // protected by a mutex) + std::tie(*g_initialDomainMap.lock(), *g_initialAllowNotifyFor.lock()) = parseZoneConfiguration(g_yamlSettings); + } g_latencyStatSize = ::arg().asNum("latency-statistic-size");