diff options
author | Daniel P. Berrange <berrange@redhat.com> | 2013-09-25 15:26:58 +0100 |
---|---|---|
committer | Daniel P. Berrange <berrange@redhat.com> | 2013-09-25 18:12:09 +0100 |
commit | 4f2094346d98f4ed6a2de115d204c166cc563496 (patch) | |
tree | 232464ca10b1273e470ea2814b43d2c01dcb6f92 /tests/nwfilterxml2xmltest.c | |
parent | 06bfe6fe2b6396c48d1c98eaea409d15ac9f7bb7 (diff) | |
download | libvirt-4f2094346d98f4ed6a2de115d204c166cc563496.tar.gz |
Don't ignore errors parsing nwfilter rules
For inexplicable reasons, the nwfilter XML parser is intentionally
ignoring errors that arise during parsing. As well as meaning that
users don't get any feedback on their XML mistakes, this will lead
it to silently drop data in OOM conditions.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Diffstat (limited to 'tests/nwfilterxml2xmltest.c')
-rw-r--r-- | tests/nwfilterxml2xmltest.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/tests/nwfilterxml2xmltest.c b/tests/nwfilterxml2xmltest.c index 5476284d73..84e61da1b1 100644 --- a/tests/nwfilterxml2xmltest.c +++ b/tests/nwfilterxml2xmltest.c @@ -36,15 +36,12 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml, virResetLastError(); - if (!(dev = virNWFilterDefParseString(NULL, inXmlData))) + if (!(dev = virNWFilterDefParseString(NULL, inXmlData))) { + if (expect_error) { + virResetLastError(); + goto done; + } goto fail; - - if (!!virGetLastError() != expect_error) - goto fail; - - if (expect_error) { - /* need to suppress the errors */ - virResetLastError(); } if (!(actual = virNWFilterDefFormat(dev))) @@ -55,6 +52,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml, goto fail; } + done: ret = 0; fail: |