summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport/src/termios.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2006-03-07 22:23:15 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2006-03-07 22:23:15 +0000
commit360d9da6161754250579ed1bd37e97504f399b32 (patch)
tree455bc3dedf715b5831e82d02c89b7f5d553c3429 /cpukit/libcsupport/src/termios.c
parent2006-03-07 Steven Johnson <sjohnson@sakuraindustries.com> (diff)
downloadrtems-360d9da6161754250579ed1bd37e97504f399b32.tar.bz2
2006-03-07 Till Strauman <strauman@slac.stanford.edu>
PR 830/filesystem * libcsupport/src/termios.c: termios ioctl(FIONREAD) reported wrong number of characters. So add chars in low-level/raw buffer to total count.
Diffstat (limited to 'cpukit/libcsupport/src/termios.c')
-rw-r--r--cpukit/libcsupport/src/termios.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/cpukit/libcsupport/src/termios.c b/cpukit/libcsupport/src/termios.c
index 4586654fdd..1917c68735 100644
--- a/cpukit/libcsupport/src/termios.c
+++ b/cpukit/libcsupport/src/termios.c
@@ -613,8 +613,13 @@ rtems_termios_ioctl (void *arg)
break;
#endif
case FIONREAD:
+ {
+ int rawnc = tty->rawInBuf.Tail - tty->rawInBuf.Head;
+ if ( rawnc < 0 )
+ rawnc += tty->rawInBuf.Size;
/* Half guess that this is the right operation */
- *(int *)args->buffer = tty->ccount - tty->cindex;
+ *(int *)args->buffer = tty->ccount - tty->cindex + rawnc;
+ }
break;
}
rtems_semaphore_release (tty->osem);