Skip to content

Commit 3363ef7

Browse files
author
Peter van Dijk
committed
initialise server-id after all parsing is done, instead of half way through. Fixes situations where server-id was emptied explicitly. Reported by Wouter de Jong
1 parent cd4f253 commit 3363ef7

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

pdns/receiver.cc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -524,12 +524,6 @@ int main(int argc, char **argv)
524524
daemonize();
525525
}
526526

527-
if(::arg()["server-id"].empty()) {
528-
char tmp[128];
529-
gethostname(tmp, sizeof(tmp)-1);
530-
::arg().set("server-id")=tmp;
531-
}
532-
533527
if(isGuarded(argv)) {
534528
L<<Logger::Warning<<"This is a guarded instance of pdns"<<endl;
535529
dl=new DynListener; // listens on stdin
@@ -567,6 +561,13 @@ int main(int argc, char **argv)
567561
if(!::arg().mustDo("no-config"))
568562
::arg().file(configname.c_str());
569563
::arg().parse(argc,argv);
564+
565+
if(::arg()["server-id"].empty()) {
566+
char tmp[128];
567+
gethostname(tmp, sizeof(tmp)-1);
568+
::arg().set("server-id")=tmp;
569+
}
570+
570571
UeberBackend::go();
571572
N=new UDPNameserver; // this fails when we are not root, throws exception
572573

0 commit comments

Comments
 (0)