Patchwork [02/18] QMP: handle_qmp_command(): Move 'cmd' sanity check

login
register
mail settings
Submitter Luiz Capitulino
Date Sept. 16, 2010, 8:20 p.m.
Message ID <1284668464-15981-3-git-send-email-lcapitulino@redhat.com>
Download mbox | patch
Permalink /patch/64999/
State New
Headers show

Comments

Luiz Capitulino - Sept. 16, 2010, 8:20 p.m.
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 <lcapitulino@redhat.com>
---
 monitor.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

Patch

diff --git a/monitor.c b/monitor.c
index 98fc57a..b2d8a2d 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");