Skip to content

Commit

Permalink
char: drop data written to a disconnected pty
Browse files Browse the repository at this point in the history
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 <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
Ed Swierk authored and bonzini committed Feb 16, 2017
1 parent f65e821 commit 1c64fdb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion chardev/char-pty.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1c64fdb

Please sign in to comment.