Patchwork [1/3] QMP: Fix default response regression

login
register
mail settings
Submitter Luiz Capitulino
Date Nov. 23, 2010, 6:49 p.m.
Message ID <1290538175-2437-2-git-send-email-lcapitulino@redhat.com>
Download mbox | patch
Permalink /patch/72722/
State New
Headers show

Comments

Luiz Capitulino - Nov. 23, 2010, 6:49 p.m.
Commit 030db6e89d dropped do_info() usage from QMP and introduced
qmp_call_query_cmd(). However, the new function doesn't emit QMP's
default OK response when the handler doesn't return data.

Fix that by also calling monitor_protocol_emitter() when
ret_data == NULL, so that the default response is emitted.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 monitor.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

Patch

diff --git a/monitor.c b/monitor.c
index 8cee35d..c4efe58 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4426,10 +4426,8 @@  static void qmp_call_query_cmd(Monitor *mon, const mon_cmd_t *cmd)
         }
     } else {
         cmd->mhandler.info_new(mon, &ret_data);
-        if (ret_data) {
-            monitor_protocol_emitter(mon, ret_data);
-            qobject_decref(ret_data);
-        }
+        monitor_protocol_emitter(mon, ret_data);
+        qobject_decref(ret_data);
     }
 }