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>
This commit is contained in:
Daniel P. Berrange
2013-09-25 15:26:58 +01:00
parent 06bfe6fe2b
commit 4f2094346d
2 changed files with 14 additions and 16 deletions

View File

@@ -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: