aboutsummaryrefslogtreecommitdiff
path: root/chardev
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2021-08-04 19:12:54 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2021-08-05 16:15:33 +0400
commita68403b0a6843f106e381b0bbeaacb29f6d27255 (patch)
tree12646d8aca7f9ab87128bf32637c6b4645dd1d38 /chardev
parent64195b0d365712c05ae922b7ff22cf136aac1400 (diff)
chardev: report a simpler error about duplicated id
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>
Diffstat (limited to 'chardev')
-rw-r--r--chardev/char.c5
1 files changed, 5 insertions, 0 deletions
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;