mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
- Added an error/EOF check in the input drain loop.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14972 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: termios_tcflush.c,v 1.1 2005-06-04 10:46:21 obarthel Exp $
|
||||
* $Id: termios_tcflush.c,v 1.2 2005-06-04 13:57:08 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -79,6 +79,8 @@ tcflush(int file_descriptor,int queue)
|
||||
|
||||
if(queue == TCIFLUSH || queue == TCIOFLUSH)
|
||||
{
|
||||
LONG num_bytes_read;
|
||||
|
||||
/* Set raw mode so we can read without blocking. */
|
||||
if(FLAG_IS_SET(tios->c_lflag,ICANON))
|
||||
{
|
||||
@ -92,7 +94,10 @@ tcflush(int file_descriptor,int queue)
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
Read(fd->fd_DefaultFile,buf,64); /* Read away available data. (upto 8k) */
|
||||
/* Read away available data. (upto 8k) */
|
||||
num_bytes_read = Read(fd->fd_DefaultFile,buf,64);
|
||||
if(num_bytes_read == ERROR || num_bytes_read == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Restore the Raw/Cooked mode. */
|
||||
|
||||
Reference in New Issue
Block a user