]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Merge pull request #6364 from rgacogne/dnsdist-macro-sonar
authorRemi Gacogne <rgacogne@users.noreply.github.com>
Tue, 20 Mar 2018 15:12:56 +0000 (16:12 +0100)
committerGitHub <noreply@github.com>
Tue, 20 Mar 2018 15:12:56 +0000 (16:12 +0100)
dnsdist: Fix 'unreachable code' warnings reported by SonarCloud

pdns/dnsdist-snmp.cc
pdns/misc.cc

index 4d3adf51a570045ebd6177d6647eb80ab63f4822..90cad6873195e7eeeb7b087f5a3ab8bfd4167cbb 100644 (file)
@@ -404,8 +404,9 @@ bool DNSDistSNMPAgent::sendBackendStatusChangeTrap(const std::shared_ptr<Downstr
                             backendStatus.size());
 
   return sendTrap(d_trapPipe[1], varList);
-#endif /* HAVE_NET_SNMP */
+#else
   return true;
+#endif /* HAVE_NET_SNMP */
 }
 
 bool DNSDistSNMPAgent::sendCustomTrap(const std::string& reason)
@@ -428,8 +429,9 @@ bool DNSDistSNMPAgent::sendCustomTrap(const std::string& reason)
                             reason.size());
 
   return sendTrap(d_trapPipe[1], varList);
-#endif /* HAVE_NET_SNMP */
+#else
   return true;
+#endif /* HAVE_NET_SNMP */
 }
 
 bool DNSDistSNMPAgent::sendDNSTrap(const DNSQuestion& dq, const std::string& reason)
@@ -533,8 +535,9 @@ bool DNSDistSNMPAgent::sendDNSTrap(const DNSQuestion& dq, const std::string& rea
                             reason.size());
 
   return sendTrap(d_trapPipe[1], varList);
-#endif /* HAVE_NET_SNMP */
+#else
   return true;
+#endif /* HAVE_NET_SNMP */
 }
 
 DNSDistSNMPAgent::DNSDistSNMPAgent(const std::string& name, const std::string& masterSocket): SNMPAgent(name, masterSocket)
index 92d173f6a9ba9e294d8cd973c1e43c44d5a2b415..b4c6d5cf8bd489544cef083a60b28d5e4c0026cb 100644 (file)
@@ -1058,8 +1058,9 @@ bool setSocketTimestamps(int fd)
 #ifdef SO_TIMESTAMP
   int on=1;
   return setsockopt(fd, SOL_SOCKET, SO_TIMESTAMP, (char*)&on, sizeof(on)) == 0;
-#endif
+#else
   return true; // we pretend this happened.
+#endif
 }
 
 bool setTCPNoDelay(int sock)
@@ -1402,6 +1403,7 @@ int mapThreadToCPUList(pthread_t tid, const std::set<int>& cpus)
                                 sizeof(cpuset),
                                 &cpuset);
 #  endif
-#endif /* HAVE_PTHREAD_SETAFFINITY_NP */
+#else
   return ENOSYS;
+#endif /* HAVE_PTHREAD_SETAFFINITY_NP */
 }