diff options
author | Kevin Wolf | 2020-02-24 15:30:06 +0100 |
---|---|---|
committer | Kevin Wolf | 2020-03-06 17:21:28 +0100 |
commit | 8e9119a807df510f0d2ce4cdda3078166d6e99a7 (patch) | |
tree | 95d403e3ab3b873d8a87cec6fd4530dbc2fdffb3 /tests/test-util-sockets.c | |
parent | qmp: Fail gracefully if chardev is already in use (diff) | |
download | qemu-8e9119a807df510f0d2ce4cdda3078166d6e99a7.tar.gz qemu-8e9119a807df510f0d2ce4cdda3078166d6e99a7.tar.xz qemu-8e9119a807df510f0d2ce4cdda3078166d6e99a7.zip |
hmp: Fail gracefully if chardev is already in use
Trying to attach a HMP monitor to a chardev that is already in use
results in a crash because monitor_init_hmp() passes &error_abort to
qemu_chr_fe_init():
$ ./x86_64-softmmu/qemu-system-x86_64 --chardev stdio,id=foo --mon foo --mon foo
QEMU 4.2.50 monitor - type 'help' for more information
(qemu) Unexpected error in qemu_chr_fe_init() at chardev/char-fe.c:220:
qemu-system-x86_64: --mon foo: Device 'foo' is in use
Abgebrochen (Speicherabzug geschrieben)
Fix this by allowing monitor_init_hmp() to return an error and passing
any error in qemu_chr_fe_init() to its caller instead of aborting.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20200224143008.13362-19-kwolf@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'tests/test-util-sockets.c')
-rw-r--r-- | tests/test-util-sockets.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/test-util-sockets.c b/tests/test-util-sockets.c index 2edb4c539d..5fd947c7bf 100644 --- a/tests/test-util-sockets.c +++ b/tests/test-util-sockets.c @@ -72,7 +72,7 @@ int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp) __thread Monitor *cur_mon; int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) { abort(); } void monitor_init_qmp(Chardev *chr, bool pretty, Error **errp) {} -void monitor_init_hmp(Chardev *chr, bool use_readline) {} +void monitor_init_hmp(Chardev *chr, bool use_readline, Error **errp) {} static void test_socket_fd_pass_name_good(void) |