summary refs log tree commit diff stats
path: root/qemu-char.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--qemu-char.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/qemu-char.c b/qemu-char.c
index 10d1504948..7f0f895157 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -2329,8 +2329,10 @@ static void tcp_chr_connect(void *opaque)
     TCPCharDriver *s = chr->opaque;
 
     s->connected = 1;
-    qemu_set_fd_handler2(s->fd, tcp_chr_read_poll,
-                         tcp_chr_read, NULL, chr);
+    if (s->fd >= 0) {
+        qemu_set_fd_handler2(s->fd, tcp_chr_read_poll,
+                             tcp_chr_read, NULL, chr);
+    }
     qemu_chr_generic_open(chr);
 }