From: Daniel P. Berrange Date: Fri, 28 May 2010 11:18:09 +0000 (+0100) Subject: Fix check for errors in device_add command in QEMU text monitor X-Git-Tag: v0.8.2~112 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c833efd35bf613851969ba0860ae89b83f155ad1;p=thirdparty%2Flibvirt.git Fix check for errors in device_add command in QEMU text monitor Any output at all from device_add indicates an error in the command execution. Thus it needs to check for reply != "" * src/qemu/qemu_monitor_text.c: Fix reply check for errors to treat any output as an error --- diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c index 4b1e2ecd8d..c0ebe5f369 100644 --- a/src/qemu/qemu_monitor_text.c +++ b/src/qemu/qemu_monitor_text.c @@ -2319,11 +2319,11 @@ int qemuMonitorTextAddDevice(qemuMonitorPtr mon, goto cleanup; } - /* If the command failed qemu prints: - * Could not add ... */ - if (strstr(reply, "Could not add ")) { + /* If the command succeeds, no output is sent. So + * any non-empty string shows an error */ + if (STRNEQ(reply, "")) { qemuReportError(VIR_ERR_OPERATION_FAILED, - _("adding %s device failed"), devicestr); + _("adding %s device failed: %s"), devicestr, reply); goto cleanup; }