From 0fb88582e60e16e809c1aabc2c4b3e1f0832e267 Mon Sep 17 00:00:00 2001 From: Luiz Capitulino Date: Wed, 15 Sep 2010 10:56:17 -0300 Subject: [PATCH] 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 --- monitor.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/monitor.c b/monitor.c index da76eab..2efff8a 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"); -- 2.7.4