diff options
-rw-r--r-- | qemu-char.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/qemu-char.c b/qemu-char.c index 398baf1e04..767da93862 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -2148,10 +2148,12 @@ static int tcp_chr_write(CharDriverState *chr, const uint8_t *buf, int len) TCPCharDriver *s = chr->opaque; if (s->connected) { return send_all(s->fd, buf, len); - } else { + } else if (s->listen_fd == -1) { /* (Re-)connect for unconnected writing */ tcp_chr_connect(chr); return 0; + } else { + return len; } } |