From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57547) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zhmxx-0001dj-CQ for qemu-devel@nongnu.org; Thu, 01 Oct 2015 19:08:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zhmxu-0003ON-4b for qemu-devel@nongnu.org; Thu, 01 Oct 2015 19:08:45 -0400 Received: from e18.ny.us.ibm.com ([129.33.205.208]:45648) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zhmxu-0003Nt-1o for qemu-devel@nongnu.org; Thu, 01 Oct 2015 19:08:42 -0400 Received: from localhost by e18.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 1 Oct 2015 19:08:41 -0400 Received: from b01cxnp22033.gho.pok.ibm.com (b01cxnp22033.gho.pok.ibm.com [9.57.198.23]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id 6DF6F38C8046 for ; Thu, 1 Oct 2015 19:08:37 -0400 (EDT) Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t91N8bdx36438038 for ; Thu, 1 Oct 2015 23:08:37 GMT Received: from d01av04.pok.ibm.com (localhost [127.0.0.1]) by d01av04.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t91N8bPc032278 for ; Thu, 1 Oct 2015 19:08:37 -0400 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Roth In-Reply-To: <1443685083-6242-3-git-send-email-den@openvz.org> References: <1443685083-6242-1-git-send-email-den@openvz.org> <1443685083-6242-3-git-send-email-den@openvz.org> Message-ID: <20151001215452.32707.75726@loki> Date: Thu, 01 Oct 2015 16:54:52 -0500 Subject: Re: [Qemu-devel] [PATCH 2/5] qga: handle G_IO_STATUS_AGAIN in ga_channel_write_all() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Denis V. Lunev" Cc: Yuri Pudgorodskiy , qemu-devel@nongnu.org Quoting Denis V. Lunev (2015-10-01 02:38:00) > From: Yuri Pudgorodskiy > = > glib may return G_IO_STATUS_AGAIN which is actually not an error. > Also fixed a bug when on incomplete write buf pointer was not adjusted. > = > Signed-off-by: Yuri Pudgorodskiy > Signed-off-by: Denis V. Lunev > CC: Michael Roth Reviewed-by: Michael Roth > --- > qga/channel-posix.c | 23 +++++++++++------------ > 1 file changed, 11 insertions(+), 12 deletions(-) > = > diff --git a/qga/channel-posix.c b/qga/channel-posix.c > index 8aad4fe..7be92cc 100644 > --- a/qga/channel-posix.c > +++ b/qga/channel-posix.c > @@ -217,25 +217,24 @@ GIOStatus ga_channel_write_all(GAChannel *c, const = gchar *buf, gsize size) > GIOStatus status =3D G_IO_STATUS_NORMAL; > = > while (size) { > + g_debug("sending data, count: %d", (int)size); > status =3D g_io_channel_write_chars(c->client_channel, buf, size, > &written, &err); > - g_debug("sending data, count: %d", (int)size); > - if (err !=3D NULL) { > + if (status =3D=3D G_IO_STATUS_NORMAL) { > + size -=3D written; > + buf +=3D written; > + } else if (status !=3D G_IO_STATUS_AGAIN) { > g_warning("error writing to channel: %s", err->message); > - return G_IO_STATUS_ERROR; > - } > - if (status !=3D G_IO_STATUS_NORMAL) { > - break; > + return status; > } > - size -=3D written; > } > = > - if (status =3D=3D G_IO_STATUS_NORMAL) { > + do { > status =3D g_io_channel_flush(c->client_channel, &err); > - if (err !=3D NULL) { > - g_warning("error flushing channel: %s", err->message); > - return G_IO_STATUS_ERROR; > - } > + } while (status =3D=3D G_IO_STATUS_AGAIN); > + > + if (status !=3D G_IO_STATUS_NORMAL) { > + g_warning("error flushing channel: %s", err->message); > } > = > return status; > -- = > 2.1.4 >=20