From 47b0c3f2f5dd7dea486aa023a007cb2442da0676 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 4 Jan 2017 15:52:10 +0100 Subject: qga: fix erroneous argument to strerror MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Marc-André Lureau Signed-off-by: Michael Tokarev --- qga/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'qga') diff --git a/qga/main.c b/qga/main.c index 6caf215575..538e4ee299 100644 --- a/qga/main.c +++ b/qga/main.c @@ -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); } -- cgit v1.2.3