summaryrefslogtreecommitdiff
path: root/net/powerdns-recursor/patches/patch-rec-carbon.cc
diff options
context:
space:
mode:
Diffstat (limited to 'net/powerdns-recursor/patches/patch-rec-carbon.cc')
-rw-r--r--net/powerdns-recursor/patches/patch-rec-carbon.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/net/powerdns-recursor/patches/patch-rec-carbon.cc b/net/powerdns-recursor/patches/patch-rec-carbon.cc
new file mode 100644
index 00000000000..42628a0d984
--- /dev/null
+++ b/net/powerdns-recursor/patches/patch-rec-carbon.cc
@@ -0,0 +1,31 @@
+$NetBSD: patch-rec-carbon.cc,v 1.1.2.2 2020/06/25 18:21:29 bsiegert Exp $
+
+backport changes based on PR #9127 from
+https://github.com/PowerDNS/pdns/pull/9127
+
+--- rec-carbon.cc.orig 2020-06-17 21:27:18.582569489 +0000
++++ rec-carbon.cc
+@@ -32,17 +32,13 @@ try
+ if(namespace_name.empty()) {
+ namespace_name="pdns";
+ }
+- if(hostname.empty()) {
+- char tmp[HOST_NAME_MAX+1];
+- memset(tmp, 0, sizeof(tmp));
+- if (gethostname(tmp, sizeof(tmp)) != 0) {
+- throw std::runtime_error("The 'carbon-ourname' setting has not been set and we are unable to determine the system's hostname: " + stringerror());
++ if (hostname.empty()) {
++ try {
++ hostname = getCarbonHostName();
++ }
++ catch(const std::exception& e) {
++ throw std::runtime_error(std::string("The 'carbon-ourname' setting has not been set and we are unable to determine the system's hostname: ") + e.what());
+ }
+- char *p = strchr(tmp, '.');
+- if(p) *p=0;
+-
+- hostname=tmp;
+- boost::replace_all(hostname, ".", "_");
+ }
+ if(instance_name.empty()) {
+ instance_name="recursor";