mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user