From: Daniel P. Berrange Date: Tue, 2 Mar 2010 17:16:30 +0000 (+0000) Subject: Fix detection of errors in QEMU device_add command X-Git-Tag: v0.7.7~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=44f687297a7102c90cb0b85451c719c92a7a6dc1;p=thirdparty%2Flibvirt.git Fix detection of errors in QEMU device_add command The code assumed that 'device_add' returned an empty string upon success. This is not true, it sometimes prints random debug info. THus we need to check for an explicit fail string * src/qemu/qemu_monitor_text.c: Fix error checking of the device_add monitor command --- diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c index 69df40760a..82f7a9b9cb 100644 --- a/src/qemu/qemu_monitor_text.c +++ b/src/qemu/qemu_monitor_text.c @@ -2123,9 +2123,11 @@ int qemuMonitorTextAddDevice(qemuMonitorPtr mon, goto cleanup; } - if (STRNEQ(reply, "")) { + /* If the command failed qemu prints: + * Could not add ... */ + if (strstr(reply, "Could not add ")) { qemuReportError(VIR_ERR_OPERATION_FAILED, - _("adding %s device failed: %s"), devicestr, reply); + _("adding %s device failed"), devicestr); goto cleanup; }