From: pdns-recursor packagers Date: Mon, 18 Mar 2024 22:34:27 +0000 (+0100) Subject: hostname-4.1.15 X-Git-Tag: archive/raspbian/4.1.11-1+rpi1+deb10u2^2~4 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=53d8ade8c080e49218c34d7b24d99b19793bce36;p=pdns-recursor.git hostname-4.1.15 =================================================================== Gbp-Pq: Name hostname-4.1.15.diff --- diff --git a/rec-carbon.cc b/rec-carbon.cc index f8098ed..3ffde28 100644 --- a/rec-carbon.cc +++ b/rec-carbon.cc @@ -26,9 +26,11 @@ try return; if(hostname.empty()) { - char tmp[80]; + char tmp[HOST_NAME_MAX+1]; memset(tmp, 0, sizeof(tmp)); - gethostname(tmp, 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()); + } char *p = strchr(tmp, '.'); if(p) *p=0;