]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
clang-tidy, my old nemesis, we meet again.
authorMiod Vallat <miod.vallat@powerdns.com>
Mon, 25 Aug 2025 12:49:37 +0000 (14:49 +0200)
committerMiod Vallat <miod.vallat@powerdns.com>
Mon, 25 Aug 2025 12:54:15 +0000 (14:54 +0200)
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
modules/bindbackend/bindbackend2.cc

index fea6427ea0f8f0a3781eab6a592e3c922751114a..2664bdc482348df9cdba662351ca5d00b64f2c7e 100644 (file)
@@ -108,20 +108,19 @@ bool BB2DomainInfo::current()
     return true;
 
   d_lastcheck = time(nullptr);
-  for (const auto& fileinfo : d_fileinfo) {
-    if (getCtime(fileinfo.first) != fileinfo.second) {
-      return false;
-    }
-  }
-  return true;
+  // Our data is still current if all the files it has been obtained from have
+  // their modification times unchanged since the last parse.
+  return std::all_of(d_fileinfo.cbegin(), d_fileinfo.cend(),
+                     [](const auto& fileinfo) { return getCtime(fileinfo.first) == fileinfo.second; });
 }
 
 time_t BB2DomainInfo::getCtime(const std::string& filename)
 {
   struct stat buf;
 
-  if (filename.empty() || stat(filename.c_str(), &buf) < 0)
+  if (filename.empty() || stat(filename.c_str(), &buf) < 0) {
     return 0;
+  }
   return buf.st_ctime;
 }
 
@@ -264,8 +263,9 @@ bool Bind2Backend::commitTransaction()
 
   BB2DomainInfo bbd;
   if (safeGetBBDomainInfo(d_transaction_id, &bbd)) {
-    if (rename(d_transaction_tmpname.c_str(), bbd.d_fileinfo.front().first.c_str()) < 0)
+    if (rename(d_transaction_tmpname.c_str(), bbd.d_fileinfo.front().first.c_str()) < 0) {
       throw DBException("Unable to commit (rename to: '" + bbd.d_fileinfo.front().first + "') AXFRed zone: " + stringerror());
+    }
     queueReloadAndStore(bbd.d_id);
   }