diff mbox

[PULL,11/24] hmp: Fix definition of command quit

Message ID 46db7b862ab66d14679bb96563092e7ef76f1cfb.1426755483.git.mjt@msgid.tls.msk.ru
State New
Headers show

Commit Message

Michael Tokarev March 19, 2015, 9:05 a.m. UTC
From: Markus Armbruster <armbru@redhat.com>

The command handler is a union of two function types.  If
cmd->user_print is set, handle_user_command() calls
cmd->mhandler.cmd_new(), else cmd->mhandler.cmd().

Command definitions must therefore either set both user_print() and
mhandler.cmd_new(), or only mhandler.cmd().

quit's sets user_print and mhandler.cmd().  handle_user_command()
calls hmp_quit() through mhandler.cmd_new() rather than
mhandler.cmd(), i.e. through a function pointer with a different type.
Broken in commit 7a7f325, v1.0.

Works in practice because hmp_quit() doesn't use its arguments, and
handle_user_command() ignores its function value.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hmp-commands.hx | 1 -
 1 file changed, 1 deletion(-)
diff mbox

Patch

diff --git a/hmp-commands.hx b/hmp-commands.hx
index 328709d..6fd5336 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -47,7 +47,6 @@  ETEXI
         .args_type  = "",
         .params     = "",
         .help       = "quit the emulator",
-        .user_print = monitor_user_noop,
         .mhandler.cmd = hmp_quit,
     },