Skip to content

Commit

Permalink
monitor: Clean up handle_hmp_command() a bit
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Markus Armbruster committed Feb 22, 2017
1 parent dfad9ec commit bbf1028
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions monitor.c
Expand Up @@ -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;
}

Expand Down

0 comments on commit bbf1028

Please sign in to comment.