From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58208) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8Vsy-0006vC-Bb for qemu-devel@nongnu.org; Wed, 29 Jan 2014 09:13:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W8Vst-0003ac-2X for qemu-devel@nongnu.org; Wed, 29 Jan 2014 09:13:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:30378) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8Vss-0003aX-Qf for qemu-devel@nongnu.org; Wed, 29 Jan 2014 09:12:54 -0500 Date: Wed, 29 Jan 2014 09:12:44 -0500 From: Luiz Capitulino Message-ID: <20140129091244.0af6afda@redhat.com> In-Reply-To: <52E8DBEC.1040508@grnet.gr> References: <20140124184822.4a49e3ea@redhat.com> <1390818615-4926-1-git-send-email-psomas@grnet.gr> <52E8DBEC.1040508@grnet.gr> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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: Stratos Psomadakis Cc: synnefo-devel@googlegroups.com, ganeti-devel@googlegroups.com, qemu-devel@nongnu.org, dimara@grnet.gr On Wed, 29 Jan 2014 12:46:04 +0200 Stratos Psomadakis wrote: > 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/msg02890.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) > > > > if (len && !mon->mux_out) { > > rc = qemu_chr_fe_write(mon->chr, (const uint8_t *) buf, len); > > - if (rc == len) { > > - /* all flushed */ > > + if ((rc < 0 && errno != EAGAIN) || (rc == len)) { > > + /* all flushed or error */ > > QDECREF(mon->outbuf); > > mon->outbuf = qstring_new(); > > return; > > Forgot to cc the maintainer. I included it in my pull request: http://lists.nongnu.org/archive/html/qemu-devel/2014-01/msg03859.html But it seems that I forgot to reply to the patch too.