From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39111) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqPnB-0003iV-9T for qemu-devel@nongnu.org; Mon, 17 Nov 2014 12:08:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XqPn4-000682-6h for qemu-devel@nongnu.org; Mon, 17 Nov 2014 12:08:45 -0500 Received: from mail-wg0-x229.google.com ([2a00:1450:400c:c00::229]:62813) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqPn4-00067l-01 for qemu-devel@nongnu.org; Mon, 17 Nov 2014 12:08:38 -0500 Received: by mail-wg0-f41.google.com with SMTP id y19so6151279wgg.14 for ; Mon, 17 Nov 2014 09:08:35 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Mon, 17 Nov 2014 18:08:12 +0100 Message-Id: <1416244099-7217-6-git-send-email-pbonzini@redhat.com> In-Reply-To: <1416244099-7217-1-git-send-email-pbonzini@redhat.com> References: <1416244099-7217-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 05/12] qga: fix false negative argument passing List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gonglei From: Gonglei Function send_response(s, &qdict->base) returns a negative number when any failures occured. But strerror()'s parameter cannot be negative. Let's change the testing condition and pass '-ret' to strerr(). Signed-off-by: Gonglei Signed-off-by: Paolo Bonzini --- qga/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qga/main.c b/qga/main.c index 227f2bd..9939a2b 100644 --- a/qga/main.c +++ b/qga/main.c @@ -603,8 +603,8 @@ static void process_event(JSONMessageParser *parser, QList *tokens) error_free(err); } ret = send_response(s, QOBJECT(qdict)); - if (ret) { - g_warning("error sending error response: %s", strerror(ret)); + if (ret < 0) { + g_warning("error sending error response: %s", strerror(-ret)); } } -- 1.8.3.1