From: Luiz Capitulino Date: Wed, 15 Sep 2010 13:56:17 +0000 (-0300) Subject: QMP: handle_qmp_command(): Move 'cmd' sanity check X-Git-Tag: qemu-xen-4.3.0-rc1~4102^2~18 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=0fb88582e60e16e809c1aabc2c4b3e1f0832e267;p=qemu-upstream-4.3-testing.git QMP: handle_qmp_command(): Move 'cmd' sanity check Next commit will change how query commands are handled in a way that the 'cmd' sanity check is also going to be needed for query commands handling. Let's move it out of the else body then. Signed-off-by: Luiz Capitulino --- diff --git a/monitor.c b/monitor.c index da76eab16..2efff8ab2 100644 --- a/monitor.c +++ b/monitor.c @@ -4375,11 +4375,11 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens) qobject_from_jsonf("{ 'item': %s }", info_item)); } else { cmd = monitor_find_command(cmd_name); - if (!cmd || !monitor_handler_ported(cmd) - || monitor_cmd_user_only(cmd)) { - qerror_report(QERR_COMMAND_NOT_FOUND, cmd_name); - goto err_out; - } + } + + if (!cmd || !monitor_handler_ported(cmd) || monitor_cmd_user_only(cmd)) { + qerror_report(QERR_COMMAND_NOT_FOUND, cmd_name); + goto err_out; } obj = qdict_get(input, "arguments");