From 618fd547375c7232363a9aad2171e121e2cefcb4 Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Tue, 20 Feb 2018 10:23:30 +0100 Subject: [PATCH] rec NSID: guard the call to gethostname --- pdns/pdns_recursor.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index d93cd4ce5d..af0944ba25 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<