On 06/01/2015 02:09 PM, Laine Stump wrote: > This was revealed when I made a cut-paste mistake in an upgrade to > virSocketAddrGetRange(), leading to failure to check for the end > address being outside of the defined network, but a negative test case > that should have caught the error instead returned success. > ACK > > tests/sockettest.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/tests/sockettest.c b/tests/sockettest.c > index 84170d5..292edb6 100644 > --- a/tests/sockettest.c > +++ b/tests/sockettest.c > @@ -103,10 +103,12 @@ testRange(const char *saddrstr, const char *eaddrstr, > > int gotsize = virSocketAddrGetRange(&saddr, &eaddr, &netaddr, prefix); > VIR_DEBUG("Size want %d vs got %d", size, gotsize); > - if (gotsize < 0 || gotsize != size) { > - return pass ? -1 : 0; > + if (pass) { > + /* fail if virSocketAddrGetRange returns failure, or unexpected size */ > + return (gotsize < 0 || gotsize != size) ? -1 : 0; > } else { > - return pass ? 0 : -1; > + /* succeed if virSocketAddrGetRange fails, otherwise fail. */ > + return gotsize < 0 ? 0 : -1; > } > } > > -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list