aboutsummaryrefslogtreecommitdiff
path: root/qemu-char.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2014-05-19 18:57:36 +0200
committerGerd Hoffmann <kraxel@redhat.com>2014-05-21 11:57:58 +0200
commit3894c78764e1e6d8ef82c7c097749d10cf8c3981 (patch)
tree396605853d833088eb940e03b62d76ac3046f696 /qemu-char.c
parent0aff637e920c0cdb74338c6f57005f2d7cab63d6 (diff)
char: Explain qmp_chardev_add()'s unusual error handling
Character backend open hasn't been fully converted to the Error API. Some opens fail without setting an error. qmp_chardev_add() needs to detect when that happens, and set a generic error. Explain that in a comment, and inline error_is_set() for clarity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'qemu-char.c')
-rw-r--r--qemu-char.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/qemu-char.c b/qemu-char.c
index 5a7975f393..17b476edf0 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -3798,7 +3798,13 @@ ChardevReturn *qmp_chardev_add(const char *id, ChardevBackend *backend,
break;
}
- if (chr == NULL && !error_is_set(errp)) {
+ /*
+ * Character backend open hasn't been fully converted to the Error
+ * API. Some opens fail without setting an error. Set a generic
+ * error then.
+ * TODO full conversion to Error API
+ */
+ if (chr == NULL && errp && !*errp) {
error_setg(errp, "Failed to create chardev");
}
if (chr) {