summaryrefslogtreecommitdiffstats
path: root/qemu-char.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2016-03-11 18:55:24 +0100
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 20:00:37 -0600
commit9b97ff4547a4d81a106d1eb7390d12573e940ef9 (patch)
tree71fb6d71d35897993e8476d1d3c472ebc094405c /qemu-char.c
parent24c53a60b2144aa36d6f506994dbf9bb336819a4 (diff)
downloadhqemu-9b97ff4547a4d81a106d1eb7390d12573e940ef9.zip
hqemu-9b97ff4547a4d81a106d1eb7390d12573e940ef9.tar.gz
char: translate from QIOChannel error to errno
Caller of CharDriverState.chr* callback assume errno error conventions. Translate QIOChannel error to errno (this fixes potential EAGAIN regression, for ex if a vhost-user backend block, qemu_chr_fe_read_all() could get error -2 and not wait) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1457718924-19338-1-git-send-email-marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'qemu-char.c')
-rw-r--r--qemu-char.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/qemu-char.c b/qemu-char.c
index 97aaaae..270819a 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -2799,6 +2799,13 @@ static ssize_t tcp_chr_recv(CharDriverState *chr, char *buf, size_t len)
NULL);
}
+ if (ret == QIO_CHANNEL_ERR_BLOCK) {
+ errno = EAGAIN;
+ ret = -1;
+ } else if (ret == -1) {
+ errno = EIO;
+ }
+
if (msgfds_num) {
/* close and clean read_msgfds */
for (i = 0; i < s->read_msgfds_num; i++) {
OpenPOWER on IntegriCloud