From 4555bc1eb585117b77bc2e29022d43ddc2da797f Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 17 Jul 1998 22:34:54 +0000 Subject: Initialized tty->refcount to 0. When (for whatever reason) malloc() returned a buffer which was not zero-filled, the reference count was not correct. When the application exitted, the "lastClose" handler was not being called to flush the output. This problem had manifested itself on a variety of platforms. The function rtems_termios_dequeue_characters() incorrectly incremented the buffer pointers when it was invoked and there were no characters in the ring buffer. This problem had also manifested itself on a variety of platforms. The symptom was a strange repeating of the data in the transmitter buffer when the transmitter serial device was supposed to go idle. --- c/src/exec/libcsupport/src/termios.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'c/src/exec/libcsupport') diff --git a/c/src/exec/libcsupport/src/termios.c b/c/src/exec/libcsupport/src/termios.c index 2a3bfe4fd1..fef2fce5ae 100644 --- a/c/src/exec/libcsupport/src/termios.c +++ b/c/src/exec/libcsupport/src/termios.c @@ -219,6 +219,7 @@ rtems_termios_open ( tty->minor = minor; tty->major = major; + tty->refcount = 0; /* * Set up mutex semaphores @@ -922,6 +923,8 @@ rtems_termios_dequeue_characters (void *ttyp, int len) if (tty->rawOutBufState == rob_wait) rtems_semaphore_release (tty->rawOutBufSemaphore); + if ( tty->rawOutBufHead == tty->rawOutBufTail ) + return; newTail = (tty->rawOutBufTail + len) % RAW_OUTPUT_BUFFER_SIZE; if (newTail == tty->rawOutBufHead) { /* -- cgit v1.2.3