From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41791) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8SfO-0002AW-Hz for qemu-devel@nongnu.org; Wed, 29 Jan 2014 05:46:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W8SfI-00076a-B0 for qemu-devel@nongnu.org; Wed, 29 Jan 2014 05:46:46 -0500 Received: from averel.grnet-hq.admin.grnet.gr ([195.251.29.3]:49541) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8SfI-0006xK-2y for qemu-devel@nongnu.org; Wed, 29 Jan 2014 05:46:40 -0500 Message-ID: <52E8DBEC.1040508@grnet.gr> Date: Wed, 29 Jan 2014 12:46:04 +0200 From: Stratos Psomadakis MIME-Version: 1.0 References: <20140124184822.4a49e3ea@redhat.com> <1390818615-4926-1-git-send-email-psomas@grnet.gr> In-Reply-To: <1390818615-4926-1-git-send-email-psomas@grnet.gr> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="VxwmI10P6o5hhSKpFfjDAgTxvHf9X1wrK" Subject: Re: [Qemu-devel] [PATCH] monitor: Cleanup mon->outbuf on write error List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: synnefo-devel@googlegroups.com, Stratos Psomdakis , ganeti-devel@googlegroups.com, dimara@grnet.gr, Luiz Capitulino This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --VxwmI10P6o5hhSKpFfjDAgTxvHf9X1wrK Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 01/27/2014 12:30 PM, Stratos Psomadakis wrote: > In case monitor_flush() fails to write the contents of mon->outbuf to > the output device, mon->outbuf is not cleaned up properly. Check the > return code of the qemu_chr_fe_write() function and cleanup the outbuf > if it fails. > > References: http://lists.nongnu.org/archive/html/qemu-devel/2014-01/msg= 02890.html > > Signed-off-by: Stratos Psomadakis > Signed-off-by: Dimitris Aragiorgis > --- > monitor.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/monitor.c b/monitor.c > index 80456fb..cba56bc 100644 > --- a/monitor.c > +++ b/monitor.c > @@ -288,8 +288,8 @@ void monitor_flush(Monitor *mon) > =20 > if (len && !mon->mux_out) { > rc =3D qemu_chr_fe_write(mon->chr, (const uint8_t *) buf, len)= ; > - if (rc =3D=3D len) { > - /* all flushed */ > + if ((rc < 0 && errno !=3D EAGAIN) || (rc =3D=3D len)) { > + /* all flushed or error */ > QDECREF(mon->outbuf); > mon->outbuf =3D qstring_new(); > return; =20 Forgot to cc the maintainer. --=20 Stratos Psomadakis --VxwmI10P6o5hhSKpFfjDAgTxvHf9X1wrK Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBAgAGBQJS6Nv0AAoJEO/NY8gC4r+p3fIP/1dsdH0ZTA4ANTKF6M8GD0Dn fHTF5Mmydee7pfbTnWN74IedIb2si/K+mAxoa+JcqliaKYRTQ1ptW1PYSPxMKTic j4Az8ZACPJGsmx4q5shPOHjQjUyw6xWDfcj74d4BxAyP2TA9EAdzWx+C9du4IEq2 FOeLbG/eSqOVE1oIuovvihAjmH4JeqpaRdGW4itP8K/w2xTFm6sMbfy1wD1DzD6G FWnfz+u4ld8gvtnWAYsHNuxdAixXAYz7h+YIT/xUatIcxykkTrfboW8ljvcPBDWN I/LW8jVXYDvVoC+kQoRo1oKOL4p5Sdpah1Y4zz1rn3et7UDHg2uzl1i7dhZ9GmT0 t3ILKWLTuLDynU0mKEF+uvtWDH+QbjIHAVLMg9BRE6zqXBWPHq6602UBICVrEMWQ cxizSYwMVplu5nzIANo7dzA+/JQOF2muLU8uGN0Q8XzELlS4J90yvXAVPmBcME5F S/YKz0vo1qPBEJcrmjixBGiQdj+WzGafnaXge5E43eAEWj8KLzg4ON9jhClqUOV2 d0FCRX9Q6nuxR5XHTrWHF02wnyrcL1sy5hYAhr4LONMUAU4z4TzI7nnLPj3+0KUT PUqjOiOm5lHrtBI6Oxt/iepXojJazMEZsPo9Xe6WFaAvm3kkYDUnjkBvq0cwy8hS WsGy0bjiWbYuDyqeCqbS =x0bb -----END PGP SIGNATURE----- --VxwmI10P6o5hhSKpFfjDAgTxvHf9X1wrK--