* [Qemu-devel] [PATCH] vl: Fix bogus error message for implied mon ID clashing
@ 2015-01-13 13:19 Markus Armbruster
2015-01-21 8:02 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
0 siblings, 1 reply; 2+ messages in thread
From: Markus Armbruster @ 2015-01-13 13:19 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial
monitor_parse() desugars --monitor, --qmp and -qmp-pretty to --mon.
The ID it picks can clash with a user-specified ID. When it happens,
the error message is misleading.
Reproducer:
$ qemu --mon id=compat_monitor0 --monitor stdio
Message before the patch:
duplicate chardev: compat_monitor0
There's no "duplicate chardev" here. The problem is a duplicate
monitor ID. Moreover, the message provides no clue which option
caused the problem. The patch changes the message to:
qemu: --monitor stdio: Duplicate ID 'compat_monitor0' for mon
monitor_parse() is also used for creating a default monitor, but
that's not done when the user specifies a monitor, so an ID clash is
impossible then.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
vl.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/vl.c b/vl.c
index 7786b2f..1a36b78 100644
--- a/vl.c
+++ b/vl.c
@@ -2198,6 +2198,7 @@ static int mon_init_func(QemuOpts *opts, void *opaque)
static void monitor_parse(const char *optarg, const char *mode, bool pretty)
{
static int monitor_device_index = 0;
+ Error *local_err = NULL;
QemuOpts *opts;
const char *p;
char label[32];
@@ -2218,9 +2219,10 @@ static void monitor_parse(const char *optarg, const char *mode, bool pretty)
}
}
- opts = qemu_opts_create(qemu_find_opts("mon"), label, 1, NULL);
+ opts = qemu_opts_create(qemu_find_opts("mon"), label, 1, &local_err);
if (!opts) {
- fprintf(stderr, "duplicate chardev: %s\n", label);
+ error_report("%s", error_get_pretty(local_err));
+ error_free(local_err);
exit(1);
}
qemu_opt_set(opts, "mode", mode);
--
1.9.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-21 8:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-13 13:19 [Qemu-devel] [PATCH] vl: Fix bogus error message for implied mon ID clashing Markus Armbruster
2015-01-21 8:02 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
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).