OSDN Git Service

qga: fix erroneous argument to strerror
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 4 Jan 2017 14:52:10 +0000 (15:52 +0100)
committerMichael Tokarev <mjt@tls.msk.ru>
Tue, 24 Jan 2017 20:26:53 +0000 (23:26 +0300)
process_command returns a negative value in case of error.  Make this
clear in the "if" statement and fix the strerror argument to flip it
to positive.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
qga/main.c

index 6caf215..538e4ee 100644 (file)
@@ -558,8 +558,8 @@ static void process_command(GAState *s, QDict *req)
     rsp = qmp_dispatch(QOBJECT(req));
     if (rsp) {
         ret = send_response(s, rsp);
-        if (ret) {
-            g_warning("error sending response: %s", strerror(ret));
+        if (ret < 0) {
+            g_warning("error sending response: %s", strerror(-ret));
         }
         qobject_decref(rsp);
     }