--- tty.c
+++ tty.c
@@ -127,9 +127,6 @@
 {
 	struct termios	 tio;
 	int		 mode;
-#ifdef TIOCFLUSH
-	int		 what;
-#endif
 
 	if (tty->fd == -1)
 		return;
@@ -152,11 +149,7 @@
 	if (tcsetattr(tty->fd, TCSANOW, &tio) != 0)
 		fatal("tcsetattr failed");
 
-#ifdef TIOCFLUSH
-	what = 0;
-	if (ioctl(tty->fd, TIOCFLUSH, &what) != 0)
-		fatal("ioctl(TIOCFLUSH)");
-#endif
+	tcflush(tty->fd, TCIOFLUSH);
 
 	tty_putcode(tty, TTYC_SMCUP);
 
