Skip to content

Commit

Permalink
pty: Fix byte loss bug when connecting to pty
Browse files Browse the repository at this point in the history
When trying to print data to the pty, we first check if it is connected.
If not, we try to reconnect, but we drop the pending data even if we
have successfully reconnected; this makes us lose the first byte of the very
first transmission.
This small fix addresses the issue by checking once more if the pty is connected
after having tried to reconnect.

Signed-off-by: Sebastian Tanase <sebastian.tanase@openwide.fr>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
  • Loading branch information
Sebastian Tanase authored and kraxel committed Sep 5, 2014
1 parent fd884c0 commit cf7330c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion qemu-char.c
Expand Up @@ -1160,7 +1160,9 @@ static int pty_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
if (!s->connected) {
/* guest sends data, check for (re-)connect */
pty_chr_update_read_handler_locked(chr);
return 0;
if (!s->connected) {
return 0;
}
}
return io_channel_send(s->fd, buf, len);
}
Expand Down

0 comments on commit cf7330c

Please sign in to comment.