return (mon->suspend_cnt == 0) ? 1 : 0;
}
-static int invalid_qmp_mode(const Monitor *mon, const char *cmd_name)
+static int invalid_qmp_mode(const Monitor *mon, const mon_cmd_t *cmd)
{
- int is_cap = compare_cmd(cmd_name, "qmp_capabilities");
+ int is_cap = cmd->mhandler.cmd_new == do_qmp_capabilities;
return (qmp_cmd_mode(mon) ? is_cap : !is_cap);
}
cmd_name = qdict_get_str(input, "execute");
trace_handle_qmp_command(mon, cmd_name);
- if (invalid_qmp_mode(mon, cmd_name)) {
- qerror_report(QERR_COMMAND_NOT_FOUND, cmd_name);
- goto err_out;
- }
-
cmd = qmp_find_cmd(cmd_name);
- if (!cmd) {
+ if (!cmd || invalid_qmp_mode(mon, cmd)) {
qerror_report(QERR_COMMAND_NOT_FOUND, cmd_name);
goto err_out;
}