From 3af9bc3bf984ea61580105254d91228fe20c4520 Mon Sep 17 00:00:00 2001 From: Joonas Aunola Date: Tue, 29 Mar 2016 12:24:41 +0300 Subject: [PATCH] fix exit statuses to constants and return 0 when success Use EXIT_ constants instead of bools or ints when function return value is passed to exit() function. --- pdns/pdnsutil.cc | 60 ++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/pdns/pdnsutil.cc b/pdns/pdnsutil.cc index ffb2c34fa..e714b07f7 100644 --- a/pdns/pdnsutil.cc +++ b/pdns/pdnsutil.cc @@ -642,13 +642,13 @@ int checkAllZones(DNSSECKeeper &dk, bool exitOnError) if (checkZone(dk, B, di.zone) > 0) { errors++; if(exitOnError) - return 1; + return EXIT_FAILURE; } } cout<<"Checked "<deleteDomain(zone)) - return 0; + return EXIT_SUCCESS; cerr<<"Failed to delete domain '"<list(zone, di.id); DNSResourceRecord rr; @@ -845,7 +845,7 @@ int listZone(const DNSName &zone) { cout<startTransaction(zone, di.id)) { cerr<<"Unable to start transaction for load of zone '"<commitTransaction(); - return 0; + return EXIT_SUCCESS; } int editZone(DNSSECKeeper& dk, const DNSName &zone) { @@ -898,7 +898,7 @@ int editZone(DNSSECKeeper& dk, const DNSName &zone) { if (! B.getDomainInfo(zone, di)) { cerr<<"Domain '"< pre, post; char tmpnam[]="/tmp/pdnsutil-XXXXXX"; @@ -957,7 +957,7 @@ int editZone(DNSSECKeeper& dk, const DNSName &zone) { stat(tmpnam,&statafter); if(first && statbefore.st_ctime == statafter.st_ctime) { cout<<"No change to file"<replaceRRSet(di.id, c.first, QType(c.second), vrr); } rectifyZone(dk, zone); - return 0; + return EXIT_SUCCESS; } @@ -1062,7 +1062,7 @@ int loadZone(DNSName zone, const string& fname) { if(!B.getDomainInfo(zone, di)) { cerr<<"Domain '"<startTransaction(zone, di.id)) { cerr<<"Unable to start transaction for load of zone '"<feedRecord(rr); } db->commitTransaction(); - return 0; + return EXIT_SUCCESS; } int createZone(const DNSName &zone, const DNSName& nsname) { @@ -1090,13 +1090,13 @@ int createZone(const DNSName &zone, const DNSName& nsname) { DomainInfo di; if (B.getDomainInfo(zone, di)) { cerr<<"Domain '"<commitTransaction(); - return 1; + return EXIT_SUCCESS; } int createSlaveZone(const vector& cmds) { @@ -1133,14 +1133,14 @@ int createSlaveZone(const vector& cmds) { DNSName zone(cmds[1]); if (B.getDomainInfo(zone, di)) { cerr<<"Domain '"<setKind(zone, DomainInfo::Slave); di.backend->setMaster(zone, master.toStringWithPort()); @@ -1166,7 +1166,7 @@ int addOrReplaceRecord(bool addOrReplace, const vector& cmds) { if(!B.getDomainInfo(zone, di)) { cerr<<"Domain '"<& cmds) { while(di.backend->get(rr)) { cout<replaceRRSet(di.id, name, qt, vector()); - return 0; + return EXIT_SUCCESS; } int listAllZones(const string &type="") { -- 2.40.0