From 776c2fe86aa1371f94f19f696813531f33a7d24d Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Mon, 17 Feb 2025 09:15:34 +0100 Subject: [PATCH] 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. --- pdns/recursordist/rec-main.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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"); -- 2.47.2