]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
pdnsutil: Catch possible PDNSException when doing setMaster in changeSlaveZoneMaster() 4370/head
authorHannu Ylitalo <hnsk@hnsk.net>
Tue, 30 Aug 2016 10:58:51 +0000 (13:58 +0300)
committerHannu Ylitalo <hnsk@hnsk.net>
Tue, 30 Aug 2016 10:58:51 +0000 (13:58 +0300)
pdns/pdnsutil.cc

index 51d34326e4813179040dab17ba19a0ea927c3593..29793cce14b4482c6e091a3cb9169428dd59c629 100644 (file)
@@ -1211,8 +1211,14 @@ int changeSlaveZoneMaster(const vector<string>& cmds) {
     masters.push_back(master.toStringWithPort());
   }
   cerr<<"Updating slave zone '"<<zone<<"', master(s) to '"<<boost::join(masters, ",")<<"'"<<endl;
-  di.backend->setMaster(zone, boost::join(masters, ","));
-  return EXIT_SUCCESS;
+  try {
+    di.backend->setMaster(zone, boost::join(masters, ","));
+    return EXIT_SUCCESS;
+  }
+  catch (PDNSException& e) {
+    cerr<<"Setting master for zone '"<<zone<<"' failed: "<<e.reason<<endl;
+    return EXIT_FAILURE;
+  }
 }
 
 // add-record ZONE name type [ttl] "content" ["content"]