From: Joonas Aunola Date: Tue, 29 Mar 2016 09:24:41 +0000 (+0300) Subject: fix exit statuses to constants and return 0 when success X-Git-Tag: dnsdist-1.0.0-beta1~17^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F3632%2Fhead;p=thirdparty%2Fpdns.git 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. --- diff --git a/pdns/pdnsutil.cc b/pdns/pdnsutil.cc index ffb2c34fa8..e714b07f7f 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="") {