summaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2009-11-26 22:59:00 -0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-12-03 09:41:23 -0600
commit956f1a0d838e8045020ff8175e9ac3982b1e8079 (patch)
treea7b87565f2edb9425b437e37276a6038157c0a2a /monitor.c
parent25b422eb4051b9b7473feea1ae848f1e3b4f799f (diff)
downloadqemu-956f1a0d838e8045020ff8175e9ac3982b1e8079.tar.gz
qemu-956f1a0d838e8045020ff8175e9ac3982b1e8079.tar.bz2
qemu-956f1a0d838e8045020ff8175e9ac3982b1e8079.zip
QMP: do_info() checks
This commit adds specific QMP checks to do_info(), so that it behaves as expected in QMP mode. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/monitor.c b/monitor.c
index 8d05164ac2..70665bd789 100644
--- a/monitor.c
+++ b/monitor.c
@@ -367,16 +367,23 @@ static void do_info(Monitor *mon, const QDict *qdict, QObject **ret_data)
const mon_cmd_t *cmd;
const char *item = qdict_get_try_str(qdict, "item");
- if (!item)
+ if (!item) {
+ assert(monitor_ctrl_mode(mon) == 0);
goto help;
+ }
for (cmd = info_cmds; cmd->name != NULL; cmd++) {
if (compare_cmd(item, cmd->name))
break;
}
- if (cmd->name == NULL)
+ if (cmd->name == NULL) {
+ if (monitor_ctrl_mode(mon)) {
+ qemu_error_new(QERR_COMMAND_NOT_FOUND, item);
+ return;
+ }
goto help;
+ }
if (monitor_handler_ported(cmd)) {
cmd->mhandler.info_new(mon, ret_data);
@@ -390,7 +397,12 @@ static void do_info(Monitor *mon, const QDict *qdict, QObject **ret_data)
cmd->user_print(mon, *ret_data);
}
} else {
- cmd->mhandler.info(mon);
+ if (monitor_ctrl_mode(mon)) {
+ /* handler not converted yet */
+ qemu_error_new(QERR_COMMAND_NOT_FOUND, item);
+ } else {
+ cmd->mhandler.info(mon);
+ }
}
return;