summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/shared/console.c
diff options
context:
space:
mode:
Diffstat (limited to 'c/src/lib/libbsp/shared/console.c')
-rw-r--r--c/src/lib/libbsp/shared/console.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/c/src/lib/libbsp/shared/console.c b/c/src/lib/libbsp/shared/console.c
index c897544a79..e294fc1714 100644
--- a/c/src/lib/libbsp/shared/console.c
+++ b/c/src/lib/libbsp/shared/console.c
@@ -128,10 +128,15 @@ rtems_device_driver console_close(
{
rtems_libio_open_close_args_t *args = arg;
- if ( (args->iop->flags&LIBIO_FLAGS_READ) &&
- Console_Port_Tbl[minor].pDeviceFlow &&
- Console_Port_Tbl[minor].pDeviceFlow->deviceStopRemoteTx) {
- Console_Port_Tbl[minor].pDeviceFlow->deviceStopRemoteTx(minor);
+ /* Get the tty refcount to determine if we need to do deviceStopRemoteTx.
+ * Stop only if it's the last one opened.
+ */
+ if ( (current_tty->refcount == 1) ) {
+ if ( (args->iop->flags&LIBIO_FLAGS_READ) &&
+ Console_Port_Tbl[minor].pDeviceFlow &&
+ Console_Port_Tbl[minor].pDeviceFlow->deviceStopRemoteTx) {
+ Console_Port_Tbl[minor].pDeviceFlow->deviceStopRemoteTx(minor);
+ }
}
return rtems_termios_close (arg);