On 08/25/2011 10:49 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange"<berra...@redhat.com>

On success, the 'sendkey' command does not return any data, so
any data in the reply should be considered to be an error
message

* src/qemu/qemu_monitor_text.c: Treat non-"" reply data as an
   error message for 'sendkey' command
---
  src/qemu/qemu_monitor_text.c |   15 ++++++++++++---
  1 files changed, 12 insertions(+), 3 deletions(-)

ACK.

@@ -2880,13 +2881,21 @@ int qemuMonitorTextSendKey(qemuMonitorPtr mon,
          qemuReportError(VIR_ERR_OPERATION_FAILED,
                           _("failed to send key using command '%s'"),
                           cmd);
-        VIR_FREE(cmd);
-        return -1;
+        goto cleanup;
+    }
+
+    if (STRNEQ(reply, "")) {

I would have written this as:

if (*reply) {

but I think the compiler is sufficiently smart to optimize strcmp(expr,"") into a test for the first byte of expr (and if not, that would be a missed optimization in gcc).

--
Eric Blake   ebl...@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to