From patchwork Thu Sep 30 20:56:03 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [02/19] QMP: handle_qmp_command(): Move 'cmd' sanity check Date: Thu, 30 Sep 2010 10:56:03 -0000 From: Luiz Capitulino X-Patchwork-Id: 66256 Message-Id: <1285880180-29724-3-git-send-email-lcapitulino@redhat.com> To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, armbru@redhat.com 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 --- monitor.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/monitor.c b/monitor.c index 5aead4f..8324e65 100644 --- a/monitor.c +++ b/monitor.c @@ -4372,11 +4372,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");