From: Peter Krempa Date: Wed, 22 Oct 2014 09:22:08 +0000 (+0200) Subject: qemu: restore: Fix restoring of VM when the restore hook returns empty XML X-Git-Tag: v1.2.10-rc1~69 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e38677993734e9af3dbd0589e1cecd0b75f7e757;p=thirdparty%2Flibvirt.git qemu: restore: Fix restoring of VM when the restore hook returns empty XML The documentation for the restore hook states that returning an empty XML is equivalent with copying the input. There was a bug in the code checking the returned string by checking the string instead of the contents. Use the new helper to check if the string is empty. --- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 009abc612a..d1f960007b 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5831,7 +5831,7 @@ qemuDomainRestoreFlags(virConnectPtr conn, &xmlout)) < 0) goto cleanup; - if (hookret == 0 && xmlout) { + if (hookret == 0 && !virStringIsEmpty(xmlout)) { VIR_DEBUG("Using hook-filtered domain XML: %s", xmlout); hook_taint = true; newxml = xmlout; @@ -6047,7 +6047,7 @@ qemuDomainObjRestore(virConnectPtr conn, NULL, xml, &xmlout)) < 0) goto cleanup; - if (hookret == 0 && xmlout) { + if (hookret == 0 && !virStringIsEmpty(xmlout)) { virDomainDefPtr tmp; VIR_DEBUG("Using hook-filtered domain XML: %s", xmlout);