* fhandler_tty.cc (fhandler_pty_master::process_slave_output):

Handle buf == NULL as flushing the buffer.
	(fhandler_tty_slave::read): Handle ptr == NULL as flushing the buffer.
	(fhandler_tty_slave::tcflush): Implement input queue flushing by
	calling read with NULL buffer.
	(fhandler_pty_master::tcflush): Ditto, calling process_slave_output.
	* termios.cc (tcflush): Check for legal `queue' value.  Return
	EINVAL otherwise.
This commit is contained in:
Corinna Vinschen
2003-09-18 18:54:48 +00:00
parent b1e00863f3
commit 41946df611
3 changed files with 73 additions and 12 deletions

View File

@@ -79,6 +79,8 @@ tcflush (int fd, int queue)
if (!cfd->is_tty ())
set_errno (ENOTTY);
else if (queue != TCIFLUSH && queue != TCOFLUSH && queue != TCIOFLUSH)
set_errno (EINVAL);
else if ((res = cfd->bg_check (-SIGTTOU)) > bg_eof)
res = cfd->tcflush (queue);