From: Stratos Psomadakis <psomas@grnet.gr>
To: qemu-devel@nongnu.org
Cc: synnefo-devel@googlegroups.com,
Stratos Psomdakis <psomas@grnet.gr>,
ganeti-devel@googlegroups.com, dimara@grnet.gr,
Luiz Capitulino <lcapitulino@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] monitor: Cleanup mon->outbuf on write error
Date: Wed, 29 Jan 2014 12:46:04 +0200 [thread overview]
Message-ID: <52E8DBEC.1040508@grnet.gr> (raw)
In-Reply-To: <1390818615-4926-1-git-send-email-psomas@grnet.gr>
[-- Attachment #1: Type: text/plain, Size: 1214 bytes --]
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 <psomas@grnet.gr>
> Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
> ---
> 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.
--
Stratos Psomadakis
<psomas@grnet.gr>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]
next prev parent reply other threads:[~2014-01-29 10:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-22 15:53 [Qemu-devel] Possible bug in monitor code Stratos Psomadakis
2014-01-23 3:07 ` Fam Zheng
2014-01-23 10:17 ` Stratos Psomadakis
2014-01-24 23:48 ` Luiz Capitulino
2014-01-27 10:30 ` [Qemu-devel] [PATCH] monitor: Cleanup mon->outbuf on write error Stratos Psomadakis
2014-01-29 10:46 ` Stratos Psomadakis [this message]
2014-01-29 14:12 ` Luiz Capitulino
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52E8DBEC.1040508@grnet.gr \
--to=psomas@grnet.gr \
--cc=dimara@grnet.gr \
--cc=ganeti-devel@googlegroups.com \
--cc=lcapitulino@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=synnefo-devel@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).