]> granicus.if.org Git - pdns/commitdiff
Try to raise open files before dropping privileges
authorAki Tuomi <cmouse@desteem.org>
Tue, 3 Feb 2015 19:08:31 +0000 (21:08 +0200)
committerAki Tuomi <cmouse@desteem.org>
Tue, 3 Feb 2015 19:08:31 +0000 (21:08 +0200)
pdns/pdns_recursor.cc

index aa439795c123f81692a9db63d696dbd6fc371fa6..96251311a415dee66e827bc1e43acb37243afc84 100644 (file)
@@ -2030,6 +2030,9 @@ int serviceMain(int argc, char*argv[])
   signal(SIGPIPE,SIG_IGN);
   writePid();
   makeControlChannelSocket( ::arg().asNum("processes") > 1 ? forks : -1);
+  g_numThreads = ::arg().asNum("threads") + ::arg().mustDo("pdns-distributes-queries");
+  g_maxMThreads = ::arg().asNum("max-mthreads");
+  checkOrFixFDS();
   
   int newgid=0;
   if(!::arg()["setgid"].empty())
@@ -2048,14 +2051,11 @@ int serviceMain(int argc, char*argv[])
   }
 
   Utility::dropUserPrivs(newuid);
-  g_numThreads = ::arg().asNum("threads") + ::arg().mustDo("pdns-distributes-queries");
   
   makeThreadPipes();
   
   g_tcpTimeout=::arg().asNum("client-tcp-timeout");
   g_maxTCPPerClient=::arg().asNum("max-tcp-per-client");
-  g_maxMThreads=::arg().asNum("max-mthreads"); 
-  checkOrFixFDS();
 
   if(g_numThreads == 1) {
     L<<Logger::Warning<<"Operating unthreaded"<<endl;