提交 056f49ff 编写于 作者: S Stratos Psomadakis 提交者: Luiz Capitulino

monitor: Cleanup mon->outbuf on write error

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.htmlSigned-off-by: NStratos Psomadakis <psomas@grnet.gr>
Signed-off-by: NDimitris Aragiorgis <dimara@grnet.gr>
Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
上级 57d3e1b3
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册