From c2059a850ef85323a745512d0deb6f8575600698 Mon Sep 17 00:00:00 2001 From: Jeffrey Cody Date: Tue, 20 Mar 2012 14:07:32 -0300 Subject: [RHEL6 qemu-kvm PATCH 12/21] QMP: handle_qmp_command(): Move 'cmd' sanity check RH-Author: Jeffrey Cody Message-id: <0136c31284a1962cb04e9a437c06c838483564b3.1332249823.git.jcody@redhat.com> Patchwork-id: 38642 O-Subject: [RHEL6.3 qemu-kvm PATCH v3 12/21] QMP: handle_qmp_command(): Move 'cmd' sanity check Bugzilla: 784153 RH-Acked-by: Kevin Wolf RH-Acked-by: Paolo Bonzini RH-Acked-by: Markus Armbruster From: Luiz Capitulino 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 (cherry picked from commit 0fb88582e60e16e809c1aabc2c4b3e1f0832e267) Signed-off-by: Jeff Cody --- monitor.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) Signed-off-by: Eduardo Habkost --- monitor.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/monitor.c b/monitor.c index 61d29c6..e7616db 100644 --- a/monitor.c +++ b/monitor.c @@ -4727,11 +4727,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"); -- 1.7.3.2