diff options
author | Laine Stump <laine@laine.org> | 2011-07-21 22:48:32 -0400 |
---|---|---|
committer | Laine Stump <laine@laine.org> | 2011-07-22 09:27:07 -0400 |
commit | f7e18208e19adaacd0d84b8a47c999318f0f6192 (patch) | |
tree | 6f80487dcf225d5344da7409cd795215198bf6e5 /src/nwfilter/nwfilter_gentech_driver.c | |
parent | Refactor the certification validation code (diff) | |
download | libvirt-f7e18208e19adaacd0d84b8a47c999318f0f6192.tar.gz libvirt-f7e18208e19adaacd0d84b8a47c999318f0f6192.tar.bz2 libvirt-f7e18208e19adaacd0d84b8a47c999318f0f6192.zip |
util: make interface.c functions consistently return < 0 on error
All of the functions in util/interface.c were returning 0 on success,
but some returned -1 on error, and some returned a positive value
(usually the value of errno, but sometimes just 1). Libvirt's standard
is to return < 0 on error (in the case of functions that need to
return errno, -errno is returned.
This patch modifies all functions in interface.c to consistently
return < 0 on error, and makes changes to callers of those functions
where necessary.
Diffstat (limited to 'src/nwfilter/nwfilter_gentech_driver.c')
-rw-r--r-- | src/nwfilter/nwfilter_gentech_driver.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c index bf44fc4ed..7d9871a14 100644 --- a/src/nwfilter/nwfilter_gentech_driver.c +++ b/src/nwfilter/nwfilter_gentech_driver.c @@ -715,7 +715,7 @@ virNWFilterInstantiate(virConnectPtr conn, if (teardownOld && rc == 0) techdriver->tearOldRules(conn, ifname); - if (rc == 0 && ifaceCheck(false, ifname, NULL, ifindex)) { + if (rc == 0 && (ifaceCheck(false, ifname, NULL, ifindex) < 0)) { /* interface changed/disppeared */ techdriver->allTeardown(ifname); rc = 1; @@ -898,7 +898,7 @@ _virNWFilterInstantiateFilter(virConnectPtr conn, int ifindex; int rc; - if (ifaceGetIndex(true, net->ifname, &ifindex)) + if (ifaceGetIndex(true, net->ifname, &ifindex) < 0) return 1; virNWFilterLockFilterUpdates(); @@ -954,8 +954,8 @@ virNWFilterInstantiateFilterLate(virConnectPtr conn, &foundNewFilter); if (rc) { /* something went wrong... 'DOWN' the interface */ - if (ifaceCheck(false, ifname, NULL, ifindex) != 0 || - ifaceDown(ifname)) { + if ((ifaceCheck(false, ifname, NULL, ifindex) < 0) || + (ifaceDown(ifname) < 0)) { /* assuming interface disappeared... */ _virNWFilterTeardownFilter(ifname); } |