[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 8/8] chardev: report a simpler error about duplicated id
|
From: |
marcandre . lureau |
|
Subject: |
[PULL 8/8] chardev: report a simpler error about duplicated id |
|
Date: |
Thu, 5 Aug 2021 16:53:31 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Report:
"Chardev with id 'char2' already exists"
Rather than:
"Failed to add chardev 'char2': duplicate yank instance"
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
chardev/char.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/chardev/char.c b/chardev/char.c
index f59a61774b..4595a8d430 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -1036,6 +1036,11 @@ ChardevReturn *qmp_chardev_add(const char *id,
ChardevBackend *backend,
ChardevReturn *ret;
g_autoptr(Chardev) chr = NULL;
+ if (qemu_chr_find(id)) {
+ error_setg(errp, "Chardev with id '%s' already exists", id);
+ return NULL;
+ }
+
cc = char_get_class(ChardevBackendKind_str(backend->type), errp);
if (!cc) {
goto err;
--
2.32.0.264.g75ae10bc75
- [PULL 0/8] chardev fixes for 6.1, marcandre . lureau, 2021/08/05
- [PULL 1/8] util: fix abstract socket path copy, marcandre . lureau, 2021/08/05
- [PULL 2/8] chardev/socket: print a more correct command-line address, marcandre . lureau, 2021/08/05
- [PULL 3/8] chardev: mark explicitly first argument as poisoned, marcandre . lureau, 2021/08/05
- [PULL 4/8] chardev: fix fd_chr_add_watch() when in != out, marcandre . lureau, 2021/08/05
- [PULL 5/8] chardev: fix qemu_chr_open_fd() being called with fd=-1, marcandre . lureau, 2021/08/05
- [PULL 6/8] chardev: fix qemu_chr_open_fd() with fd_in==fd_out, marcandre . lureau, 2021/08/05
- [PULL 7/8] chardev: give some context on chardev-add error, marcandre . lureau, 2021/08/05
- [PULL 8/8] chardev: report a simpler error about duplicated id,
marcandre . lureau <=
- Re: [PULL 0/8] chardev fixes for 6.1, Peter Maydell, 2021/08/05