qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, lcapitulino@redhat.com
Subject: [Qemu-devel] [PATCH 1/2] hmp: Fix definition of command quit
Date: Fri,  6 Mar 2015 10:09:57 +0100	[thread overview]
Message-ID: <1425632998-616-2-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1425632998-616-1-git-send-email-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>
---
 hmp-commands.hx | 1 -
 1 file changed, 1 deletion(-)

diff --git a/hmp-commands.hx b/hmp-commands.hx
index 81f276b..fa5679f 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,
     },
 
-- 
1.9.3

  reply	other threads:[~2015-03-06  9:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-06  9:09 [Qemu-devel] [PATCH 0/2] monitor: Fix and clean up around .user_print Markus Armbruster
2015-03-06  9:09 ` Markus Armbruster [this message]
2015-03-06  9:09 ` [Qemu-devel] [PATCH 2/2] qmp: Drop unused .user_print from command definitions Markus Armbruster
2015-03-06 15:57 ` [Qemu-devel] [PATCH 0/2] monitor: Fix and clean up around .user_print Eric Blake
2015-03-10  6:09 ` Michael Tokarev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1425632998-616-2-git-send-email-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).