summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;