From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33162) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aiN8F-0005Pw-Tr for qemu-devel@nongnu.org; Tue, 22 Mar 2016 10:18:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aiN8B-0006mx-PB for qemu-devel@nongnu.org; Tue, 22 Mar 2016 10:18:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46248) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aiN8B-0006mg-JU for qemu-devel@nongnu.org; Tue, 22 Mar 2016 10:17:59 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 5573AC01B3E9 for ; Tue, 22 Mar 2016 14:17:59 +0000 (UTC) From: Paolo Bonzini Date: Tue, 22 Mar 2016 15:17:06 +0100 Message-Id: <1458656229-32043-27-git-send-email-pbonzini@redhat.com> In-Reply-To: <1458656229-32043-1-git-send-email-pbonzini@redhat.com> References: <1458656229-32043-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 26/29] char: translate from QIOChannel error to errno List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= From: Marc-Andr=C3=A9 Lureau 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=C3=A9 Lureau Message-Id: <1457718924-19338-1-git-send-email-marcandre.lureau@redhat.co= m> Reviewed-by: Daniel P. Berrange Signed-off-by: Paolo Bonzini --- qemu-char.c | 7 +++++++ 1 file changed, 7 insertions(+) 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); } =20 + if (ret =3D=3D QIO_CHANNEL_ERR_BLOCK) { + errno =3D EAGAIN; + ret =3D -1; + } else if (ret =3D=3D -1) { + errno =3D EIO; + } + if (msgfds_num) { /* close and clean read_msgfds */ for (i =3D 0; i < s->read_msgfds_num; i++) { --=20 2.5.0