Commit 46db7b86 authored by Markus Armbruster's avatar Markus Armbruster Committed by Michael Tokarev
Browse files

hmp: Fix definition of command quit



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 7a7f325e, v1.0.

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

Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
Reviewed-by: default avatarEric Blake <eblake@redhat.com>
Signed-off-by: default avatarMichael Tokarev <mjt@tls.msk.ru>
parent 6093d011
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -47,7 +47,6 @@ ETEXI
        .args_type  = "",
        .params     = "",
        .help       = "quit the emulator",
        .user_print = monitor_user_noop,
        .mhandler.cmd = hmp_quit,
    },