[libvirt] [PATCH 07/12] Report errors in virCapabilitiesFormatXML
Jiri Denemark
jdenemar at redhat.com
Wed Jul 2 20:37:16 UTC 2014
On Wed, Jul 02, 2014 at 12:11:00 +0200, Jano Tomko wrote:
> So far, we only report an error if formatting the siblings bitmap
> in NUMA topology fails.
>
> Be consistent and always report error in virCapabilitiesFormatXML.
> ---
> src/bhyve/bhyve_driver.c | 4 +---
> src/conf/capabilities.c | 2 +-
> src/esx/esx_driver.c | 8 +-------
> src/libxl/libxl_driver.c | 3 +--
> src/lxc/lxc_driver.c | 3 +--
> src/parallels/parallels_driver.c | 3 +--
> src/phyp/phyp_driver.c | 6 +-----
> src/qemu/qemu_driver.c | 3 +--
> src/test/test_driver.c | 3 +--
> src/uml/uml_driver.c | 3 +--
> src/xen/xen_driver.c | 8 +-------
> src/xen/xen_hypervisor.c | 8 +-------
> src/xenapi/xenapi_driver.c | 8 ++------
> tests/vircaps2xmltest.c | 4 +---
> 14 files changed, 15 insertions(+), 51 deletions(-)
>
> diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
> index eb5fc95..6c0c8b1 100644
> --- a/src/bhyve/bhyve_driver.c
> +++ b/src/bhyve/bhyve_driver.c
> @@ -150,10 +150,8 @@ bhyveConnectGetCapabilities(virConnectPtr conn)
> goto cleanup;
> }
>
> - if (!(xml = virCapabilitiesFormatXML(caps))) {
> - virReportOOMError();
> + if (!(xml = virCapabilitiesFormatXML(caps)))
> goto cleanup;
> - }
>
> cleanup:
> virObjectUnref(caps);
> diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
> index 19359a5..fca461a 100644
> --- a/src/conf/capabilities.c
> +++ b/src/conf/capabilities.c
> @@ -1025,7 +1025,7 @@ virCapabilitiesFormatXML(virCapsPtr caps)
> virBufferAdjustIndent(&buf, -2);
> virBufferAddLit(&buf, "</capabilities>\n");
>
> - if (virBufferError(&buf)) {
> + if (virBufferCheckError(&buf) < 0) {
> virBufferFreeAndReset(&buf);
> return NULL;
> }
This should be changed to
if (virBufferCheckError(&buf) < 0)
return NULL;
Jirka
More information about the libvir-list
mailing list