From 1def74548d8013949c7d4704420d4fdd5fb85268 Mon Sep 17 00:00:00 2001 From: Gonglei Date: Sat, 15 Nov 2014 18:06:42 +0800 Subject: qga: fix false negative argument passing 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(-) (limited to 'qga') diff --git a/qga/main.c b/qga/main.c index 227f2bdb88..9939a2b623 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)); } } -- cgit v1.2.3