aboutsummaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2017-02-17 21:38:24 +0100
committerMarkus Armbruster <armbru@redhat.com>2017-02-22 19:52:17 +0100
commitbbf1028a0ade883cebae5faf984f0e78cb794b17 (patch)
tree75b023523f03d7371b26bf6fcc4d73f74dd52e32 /monitor.c
parentdfad9ec4e9f15344f300996ad8c6f3eaf699d195 (diff)
downloadqemu-bbf1028a0ade883cebae5faf984f0e78cb794b17.zip
qemu-bbf1028a0ade883cebae5faf984f0e78cb794b17.tar.gz
qemu-bbf1028a0ade883cebae5faf984f0e78cb794b17.tar.bz2
monitor: Clean up handle_hmp_command() a bit
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>
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/monitor.c b/monitor.c
index 493bed9..1e352a6 100644
--- 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;
}