diff options
author | Marc-André Lureau | 2021-08-04 17:12:54 +0200 |
---|---|---|
committer | Marc-André Lureau | 2021-08-05 14:15:33 +0200 |
commit | a68403b0a6843f106e381b0bbeaacb29f6d27255 (patch) | |
tree | 12646d8aca7f9ab87128bf32637c6b4645dd1d38 /chardev | |
parent | chardev: give some context on chardev-add error (diff) | |
download | qemu-a68403b0a6843f106e381b0bbeaacb29f6d27255.tar.gz qemu-a68403b0a6843f106e381b0bbeaacb29f6d27255.tar.xz qemu-a68403b0a6843f106e381b0bbeaacb29f6d27255.zip |
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.c | 5 |
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; |