Some functions in this file were returning 1 on success and 0 on
failure, and others were returning 0 on success and -1 on
failure. Switch them all to return the libvirt-preferred 0/-1.
---
src/network/bridge_driver.c | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 5186511..1ae3924 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -373,7 +373,7 @@ networkSaveDnsmasqHostsfile(virNetworkObjPtr network,
unsigned int i;
if (! force && virFileExists(dctx->hostsfile->path))
- return 1;
+ return 0;
for (i = 0 ; i < network->def->nhosts ; i++) {
virNetworkDHCPHostDefPtr host = &(network->def->hosts[i]);
@@ -382,9 +382,9 @@ networkSaveDnsmasqHostsfile(virNetworkObjPtr network,
}
if (dnsmasqSave(dctx) < 0)
- return 0;
+ return -1;
- return 1;
+ return 0;
}
@@ -487,7 +487,7 @@ networkBuildDnsmasqArgv(virNetworkObjPtr network,
goto cleanup;
}
- if (networkSaveDnsmasqHostsfile(network, dctx, false)) {
+ if (networkSaveDnsmasqHostsfile(network, dctx, false) < 0) {
virCommandAddArgPair(cmd, "--dhcp-hostsfile",
dctx->hostsfile->path);
}
@@ -670,7 +670,7 @@ networkAddMasqueradingIptablesRules(struct network_driver *driver,
goto masqerr5;
}
- return 1;
+ return 0;
masqerr5:
iptablesRemoveForwardMasquerade(driver->iptables,
@@ -697,7 +697,7 @@ networkAddMasqueradingIptablesRules(struct network_driver *driver,
network->def->bridge,
network->def->forwardDev);
masqerr1:
- return 0;
+ return -1;
}
static int
@@ -728,7 +728,7 @@ networkAddRoutingIptablesRules(struct network_driver *driver,
goto routeerr2;
}
- return 1;
+ return 0;
routeerr2:
@@ -738,7 +738,7 @@ networkAddRoutingIptablesRules(struct network_driver *driver,
network->def->bridge,
network->def->forwardDev);
routeerr1:
- return 0;
+ return -1;
}
static int
@@ -812,11 +812,11 @@ networkAddIptablesRules(struct network_driver *driver,
/* If masquerading is enabled, set up the rules*/
if (network->def->forwardType == VIR_NETWORK_FORWARD_NAT &&
- !networkAddMasqueradingIptablesRules(driver, network))
+ networkAddMasqueradingIptablesRules(driver, network) < 0)
goto err8;
/* else if routing is enabled, set up the rules*/
else if (network->def->forwardType == VIR_NETWORK_FORWARD_ROUTE &&
- !networkAddRoutingIptablesRules(driver, network))
+ networkAddRoutingIptablesRules(driver, network) < 0)
goto err8;
/* If we are doing local DHCP service on this network, attempt to
@@ -834,7 +834,7 @@ networkAddIptablesRules(struct network_driver *driver,
VIR_WARN0("May need to update iptables package & kernel to support
CHECKSUM rule.");
}
- return 1;
+ return 0;
err8:
iptablesRemoveForwardAllowCross(driver->iptables,
@@ -858,7 +858,7 @@ networkAddIptablesRules(struct network_driver *driver,
err2:
iptablesRemoveTcpInput(driver->iptables, network->def->bridge, 67);
err1:
- return 0;
+ return -1;
}
static void
@@ -927,7 +927,7 @@ networkReloadIptablesRules(struct network_driver *driver)
if (virNetworkObjIsActive(driver->networks.objs[i])) {
networkRemoveIptablesRules(driver, driver->networks.objs[i]);
- if (!networkAddIptablesRules(driver, driver->networks.objs[i])) {
+ if (networkAddIptablesRules(driver, driver->networks.objs[i]) < 0) {
/* failed to add but already logged */
}
}
@@ -1142,7 +1142,7 @@ static int networkStartNetworkDaemon(struct network_driver *driver,
goto err_delbr;
}
- if (!networkAddIptablesRules(driver, network))
+ if (networkAddIptablesRules(driver, network) < 0)
goto err_delbr1;
if (network->def->forwardType != VIR_NETWORK_FORWARD_NONE &&
--
1.7.3.4