]> granicus.if.org Git - pdns/commitdiff
Exit gracefully if distributor-threads is less than 1
authorAki Tuomi <cmouse@cmouse.fi>
Mon, 5 Oct 2015 18:30:21 +0000 (21:30 +0300)
committerAki Tuomi <cmouse@cmouse.fi>
Mon, 5 Oct 2015 18:30:21 +0000 (21:30 +0300)
pdns/distributor.hh

index f431aabe568f1f8e17fdbb485e042a09cae5dc6a..02f668f7d710aa580afeeb106939ce5958930f0d 100644 (file)
@@ -147,6 +147,11 @@ template<class Answer, class Question, class Backend>MultiThreadDistributor<Answ
     d_pipes.push_back({fds[0],fds[1]});
   }
   
+  if (n<1) {
+    L<<Logger::Error<<"Asked for less than 1 threads, nothing to do"<<endl;
+    exit(0);
+  }
+
   L<<Logger::Warning<<"About to create "<<n<<" backend threads for UDP"<<endl;
   for(int i=0;i<n;i++) {
     pthread_create(&tid,0,&makeThread,static_cast<void *>(this));