Message ID | 1400518658-2515-4-git-send-email-armbru@redhat.com |
---|---|
State | New |
Headers | show |
On 05/19/2014 10:57 AM, Markus Armbruster wrote: > 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> > --- > qemu-char.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) Reviewed-by: Eric Blake <eblake@redhat.com>
diff --git a/qemu-char.c b/qemu-char.c index 5a7975f..17b476e 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) {
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> --- qemu-char.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)