From 46f463a62c0849f906f46d5c8d85110b66a48648 Mon Sep 17 00:00:00 2001 From: Robert Swiecki Date: Sun, 10 Mar 2019 15:00:45 +0100 Subject: [PATCH] flush stdin after nsjail ends --- nsjail.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nsjail.cc b/nsjail.cc index 0b57033..720095f 100644 --- a/nsjail.cc +++ b/nsjail.cc @@ -188,7 +188,10 @@ void setTC(int fd, const struct termios* trm) { PLOG_W("ioctl(fd=%d, TCSETS) failed", fd); return; } - LOG_D("Restored the previous state of the TTY"); + if (tcflush(fd, TCIFLUSH) == -1) { + PLOG_W("tcflush(fd=%d, TCIFLUSH) failed", fd); + return; + } } } // namespace nsjail