diff options
author | Ed Swierk <eswierk@skyportsystems.com> | 2017-01-31 05:45:29 -0800 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2017-02-16 14:06:55 +0100 |
commit | 1c64fdbc8177058802df205f5d7cd65edafa59a8 (patch) | |
tree | b610a6e7772694f175220badcc98ae55f9520199 /chardev/char-pty.c | |
parent | f65e821262029ee30c6b228e80ddeb86acdf7ff0 (diff) |
char: drop data written to a disconnected pty
When a serial port writes data to a pty that's disconnected, drop the
data and return the length dropped. This avoids triggering pointless
retries in callers like the 16550A serial_xmit(), and causes
qemu_chr_fe_write() to write all data to the log file, rather than
logging only while a pty client like virsh console happens to be
connected.
Signed-off-by: Ed Swierk <eswierk@skyportsystems.com>
Message-Id: <1485870329-79428-1-git-send-email-eswierk@skyportsystems.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'chardev/char-pty.c')
-rw-r--r-- | chardev/char-pty.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/chardev/char-pty.c b/chardev/char-pty.c index 27eb85f505..ecf2c7a5c4 100644 --- a/chardev/char-pty.c +++ b/chardev/char-pty.c @@ -129,7 +129,7 @@ static int char_pty_chr_write(Chardev *chr, const uint8_t *buf, int len) /* guest sends data, check for (re-)connect */ pty_chr_update_read_handler_locked(chr); if (!s->connected) { - return 0; + return len; } } return io_channel_send(s->ioc, buf, len); |