flush stdin after nsjail ends
authorRobert Swiecki <robert@swiecki.net>
Sun, 10 Mar 2019 14:00:45 +0000 (15:00 +0100)
committerRobert Swiecki <robert@swiecki.net>
Sun, 10 Mar 2019 14:00:45 +0000 (15:00 +0100)
nsjail.cc

index 0b57033ff6869e039d5320badf5f267b95a41734..720095f75c1ebe4804516469c8d3f37b53877176 100644 (file)
--- 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