From: Alex Jia Date: Mon, 1 Aug 2011 15:45:27 +0000 (+0800) Subject: qemu: fix return value issue X-Git-Tag: v0.9.4~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c03f7f1358a47e3bcc1575972c984233ca5da77c;p=thirdparty%2Flibvirt.git qemu: fix return value issue whether or not previous return value is -1, the following codes will be executed for a inactive guest in src/qemu/qemu_driver.c: ret = virDomainSaveConfig(driver->configDir, persistentDef); and if everything is okay, 'ret' is assigned to 0, the previous 'ret' will be overwritten, this patch will fix this issue. * src/qemu/qemu_driver.c: avoid return value is overwritten when give a argument in out of blkio weight range for a inactive guest. * how to reproduce? % virsh blkiotune ${guestname} --weight 10 % echo $? Note: guest must be inactive, argument 10 in out of blkio weight range, and can get a error information by checking libvirtd.log, however, virsh hasn't raised any error information, and return value is 0. https://bugzilla.redhat.com/show_bug.cgi?id=726304 Signed-off-by: Alex Jia --- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d856c75b5f..7155363149 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5688,7 +5688,9 @@ static int qemuDomainSetBlkioParameters(virDomainPtr dom, ret = -1; } } - ret = virDomainSaveConfig(driver->configDir, persistentDef); + + if (virDomainSaveConfig(driver->configDir, persistentDef) < 0) + ret = -1; } cleanup: