drivers/pty: Close "slave" TTYs when the "master" is closed.

The old TTY driver did this, but it was not properly carried
over into this new driver.

Fixes the first part of #18488: the child bash process from the
first session is properly closed, but the TTY state isn't reset
and there can still be stale things left in its buffer, it appears.
This commit is contained in:
Augustin Cavalier
2023-07-11 11:32:59 -04:00
parent 3cb845283e
commit 5193c8cd2f
@@ -329,6 +329,12 @@ pty_close(void *_cookie)
MutexLocker globalLocker(gGlobalTTYLock);
if (cookie->tty->is_master) {
// close all connected slave cookies first
while (tty_cookie *slave = cookie->other_tty->cookies.Head())
gTTYModule->tty_close_cookie(slave);
}
gTTYModule->tty_close_cookie(cookie);
return B_OK;