]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: Don't crash when asked to run with zero threads 5938/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 8 Nov 2017 11:23:12 +0000 (12:23 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 8 Nov 2017 11:23:12 +0000 (12:23 +0100)
pdns/pdns_recursor.cc

index e987037e064f4eb88de1c0e3b9be74e79db6f73e..324c5146871f10f8c99b4e3026ff4ef2a57032bc 100644 (file)
@@ -2986,6 +2986,11 @@ static int serviceMain(int argc, char*argv[])
   g_lowercaseOutgoing = ::arg().mustDo("lowercase-outgoing");
 
   g_numWorkerThreads = ::arg().asNum("threads");
+  if (g_numWorkerThreads < 1) {
+    L<<Logger::Warning<<"Asked to run with 0 threads, raising to 1 instead"<<endl;
+    g_numWorkerThreads = 1;
+  }
+
   g_numThreads = g_numWorkerThreads + g_weDistributeQueries;
   g_maxMThreads = ::arg().asNum("max-mthreads");