diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2021-08-04 19:12:54 +0400 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2021-08-05 16:15:33 +0400 |
commit | a68403b0a6843f106e381b0bbeaacb29f6d27255 (patch) | |
tree | 12646d8aca7f9ab87128bf32637c6b4645dd1d38 /chardev/char.c | |
parent | 64195b0d365712c05ae922b7ff22cf136aac1400 (diff) | |
download | qemu-a68403b0a6843f106e381b0bbeaacb29f6d27255.zip qemu-a68403b0a6843f106e381b0bbeaacb29f6d27255.tar.gz qemu-a68403b0a6843f106e381b0bbeaacb29f6d27255.tar.bz2 |
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/char.c')
-rw-r--r-- | chardev/char.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/chardev/char.c b/chardev/char.c index f59a617..4595a8d 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; |