From 7bef8f8a0d8c6b46c25cef60ce968eb81fbd5556 Mon Sep 17 00:00:00 2001 From: Martin Lund Date: Thu, 23 Oct 2014 10:54:23 +0200 Subject: [PATCH] Flush I/O data on connect Make sure there is no stale I/O data on tty device upon connect. --- src/tty.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tty.c b/src/tty.c index 52d2541..423ae46 100644 --- a/src/tty.c +++ b/src/tty.c @@ -157,6 +157,10 @@ int connect_tty(void) exit(EXIT_FAILURE); } + /* Flush stale I/O data (if any) */ + tcflush(fd, TCIOFLUSH); + + /* Print connect status */ color_printf("[gotty %s] Connected", current_time()); connected = true; tainted = false;