[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 10/11] chardev: report a simpler error about duplicated id
From: |
marcandre . lureau |
Subject: |
[PATCH v2 10/11] chardev: report a simpler error about duplicated id |
Date: |
Wed, 4 Aug 2021 19:48:47 +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>
---
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
- [PATCH v2 06/11] chardev: fix fd_chr_add_watch() when in != out, (continued)
- [PATCH v2 06/11] chardev: fix fd_chr_add_watch() when in != out, marcandre . lureau, 2021/08/04
- [PATCH v2 08/11] chardev: fix qemu_chr_open_fd() with fd_in==fd_out, marcandre . lureau, 2021/08/04
- [PATCH v2 04/11] chardev: add some comments about the class methods, marcandre . lureau, 2021/08/04
- [PATCH v2 02/11] chardev/socket: print a more correct command-line address, marcandre . lureau, 2021/08/04
- [PATCH v2 11/11] chardev: reuse qmp_chardev_new(), marcandre . lureau, 2021/08/04
- [PATCH v2 09/11] chardev: give some context on chardev-add error, marcandre . lureau, 2021/08/04
- [PATCH v2 10/11] chardev: report a simpler error about duplicated id,
marcandre . lureau <=