diff mbox

add close callback for tty-based char device

Message ID 4B69A1C7.80708@cisco.com (mailing list archive)
State New, archived
Headers show

Commit Message

David S. Ahern Feb. 3, 2010, 4:18 p.m. UTC
None
diff mbox

Patch

diff --git a/qemu-char.c b/qemu-char.c
index 800ee6c..ecd84ec 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -1173,6 +1173,20 @@  static int tty_serial_ioctl(CharDriverState *chr,
int cmd
     return 0;
 }

+static void qemu_chr_close_tty(CharDriverState *chr)
+{
+    FDCharDriver *s = chr->opaque;
+    int fd = -1;
+
+    if (s)
+        fd = s->fd_in;
+
+    fd_chr_close(chr);
+
+    if (fd >= 0)
+        close(fd);
+}
+
 static CharDriverState *qemu_chr_open_tty(QemuOpts *opts)
 {