From: Pieter Lexis Date: Tue, 20 Feb 2018 09:23:30 +0000 (+0100) Subject: rec NSID: guard the call to gethostname X-Git-Tag: dnsdist-1.3.1~50^2~20 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=618fd547375c7232363a9aad2171e121e2cefcb4;p=pdns rec NSID: guard the call to gethostname --- diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index d93cd4ce5..af0944ba2 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -3209,8 +3209,11 @@ static int serviceMain(int argc, char*argv[]) SyncRes::s_rootNXTrust = ::arg().mustDo( "root-nx-trust"); if(SyncRes::s_serverID.empty()) { char tmp[128]; - gethostname(tmp, sizeof(tmp)-1); - SyncRes::s_serverID=tmp; + if (gethostname(tmp, sizeof(tmp)-1) == 0){ + SyncRes::s_serverID = tmp; + } else { + L<