Skip to contentSkip to conversation

qga: fix erroneous argument to strerror

PATCH Applied Paolo Bonzini 3 participants 3 messages Jan 4, 2017 – Jan 12, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qga: fix erroneous argument to strerror

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.

---
 qga/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
qga/main.c +2 -2
index 6caf215..538e4ee 100644
@@ -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);
     }
Signature · 1 line
2.9.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Paolo Bonzini

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.

---

Quoted 22 lines
 qga/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
qga/main.c +2 -3
index 6caf215..538e4ee 100644
@@ -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);
     }
--

2.9.3

Quoted 1 line

--

Marc-André Lureau

#2 lore raw
In reply to Paolo Bonzini
Quoted 3 lines · Paolo Bonzini

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.

Applied to -trivial, thank you!

/mjt