]> git.proxmox.com Git - mirror_qemu.git/commitdiff
monitor: Clean up handle_hmp_command() a bit
authorMarkus Armbruster <armbru@redhat.com>
Fri, 17 Feb 2017 20:38:24 +0000 (21:38 +0100)
committerMarkus Armbruster <armbru@redhat.com>
Wed, 22 Feb 2017 18:52:17 +0000 (19:52 +0100)
Leave checking qobject_type(req) to qmp_check_input_obj().  Rework
handling of json_parser_parse_err() failing without setting an error.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1487363905-9480-14-git-send-email-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
monitor.c

index 493bed977cebdb8c17327846f48edd4c0d88e303..1e352a6d37a6a03b498417c45dafe68d95bbe709 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -3735,10 +3735,11 @@ static void handle_qmp_command(JSONMessageParser *parser, GQueue *tokens)
     Error *err = NULL;
 
     req = json_parser_parse_err(tokens, NULL, &err);
-    if (err || !req || qobject_type(req) != QTYPE_QDICT) {
-        if (!err) {
-            error_setg(&err, QERR_JSON_PARSING);
-        }
+    if (!req && !err) {
+        /* json_parser_parse_err() sucks: can fail without setting @err */
+        error_setg(&err, QERR_JSON_PARSING);
+    }
+    if (err) {
         goto err_out;
     }