From: Marc-André Lureau Date: Fri, 11 Mar 2016 17:55:24 +0000 (+0100) Subject: char: translate from QIOChannel error to errno X-Git-Tag: v2.6.0-rc0~9^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b6572b4f97a7b126c7b24e165893ed9fe3d72e1f;p=thirdparty%2Fqemu.git 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 Message-Id: <1457718924-19338-1-git-send-email-marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrange Signed-off-by: Paolo Bonzini --- diff --git a/qemu-char.c b/qemu-char.c index 97aaaae4390..270819aec35 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++) {