Permalink
Browse files

initialise server-id after all parsing is done, instead of half way t…

…hrough. Fixes situations where server-id was emptied explicitly. Reported by Wouter de Jong
  • Loading branch information...
1 parent cd4f253 commit 3363ef7a9200b0f989eaf746c633ba36cac5549a @Habbie Habbie committed Jun 10, 2013
Showing with 7 additions and 6 deletions.
  1. +7 −6 pdns/receiver.cc
View
@@ -524,12 +524,6 @@ int main(int argc, char **argv)
daemonize();
}
- if(::arg()["server-id"].empty()) {
- char tmp[128];
- gethostname(tmp, sizeof(tmp)-1);
- ::arg().set("server-id")=tmp;
- }
-
if(isGuarded(argv)) {
L<<Logger::Warning<<"This is a guarded instance of pdns"<<endl;
dl=new DynListener; // listens on stdin
@@ -567,6 +561,13 @@ int main(int argc, char **argv)
if(!::arg().mustDo("no-config"))
::arg().file(configname.c_str());
::arg().parse(argc,argv);
+
+ if(::arg()["server-id"].empty()) {
+ char tmp[128];
+ gethostname(tmp, sizeof(tmp)-1);
+ ::arg().set("server-id")=tmp;
+ }
+
UeberBackend::go();
N=new UDPNameserver; // this fails when we are not root, throws exception

0 comments on commit 3363ef7

Please sign in to comment.