From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56686) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEY2U-0006Nv-PI for qemu-devel@nongnu.org; Wed, 28 Aug 2013 01:11:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VEY2O-00054Z-Pp for qemu-devel@nongnu.org; Wed, 28 Aug 2013 01:11:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21498) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEY2O-00054T-Hz for qemu-devel@nongnu.org; Wed, 28 Aug 2013 01:11:24 -0400 From: Amit Shah Date: Wed, 28 Aug 2013 10:40:49 +0530 Message-Id: In-Reply-To: References: In-Reply-To: References: Subject: [Qemu-devel] [PATCH 7/9] char: use the new pty_chr_detach to dedup code List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu list Cc: Amit Shah , Paolo Bonzini , Gerd Hoffmann , Anthony Liguori , Hans de Goede Signed-off-by: Amit Shah --- qemu-char.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/qemu-char.c b/qemu-char.c index 88ed131..d667e8c 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -1141,10 +1141,7 @@ static void pty_chr_state(CharDriverState *chr, int connected) PtyCharDriver *s = chr->opaque; if (!connected) { - if (s->fd_tag) { - io_remove_watch_poll(s->fd_tag); - s->fd_tag = 0; - } + pty_chr_detach(chr); s->connected = 0; /* (re-)connect poll interval for idle guests: once per second. * We check more frequently in case the guests sends data to @@ -1169,10 +1166,7 @@ static void pty_chr_close(struct CharDriverState *chr) PtyCharDriver *s = chr->opaque; int fd; - if (s->fd_tag) { - io_remove_watch_poll(s->fd_tag); - s->fd_tag = 0; - } + pty_chr_detach(chr); fd = g_io_channel_unix_get_fd(s->fd); g_io_channel_unref(s->fd); close(fd); -- 1.8.3.1