diff options
Diffstat (limited to 'hw/virtio-console.c')
-rw-r--r-- | hw/virtio-console.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/hw/virtio-console.c b/hw/virtio-console.c index 713a761dfa..7ebfa26516 100644 --- a/hw/virtio-console.c +++ b/hw/virtio-console.c @@ -28,8 +28,22 @@ static ssize_t flush_buf(VirtIOSerialPort *port, const uint8_t *buf, size_t len) ssize_t ret; ret = qemu_chr_write(vcon->chr, buf, len); - trace_virtio_console_flush_buf(port->id, len, ret); + + if (ret < 0) { + /* + * Ideally we'd get a better error code than just -1, but + * that's what the chardev interface gives us right now. If + * we had a finer-grained message, like -EPIPE, we could close + * this connection. Absent such error messages, the most we + * can do is to return 0 here. + * + * This will prevent stray -1 values to go to + * virtio-serial-bus.c and cause abort()s in + * do_flush_queued_data(). + */ + ret = 0; + } return ret; } |