From 4f653341476e7bd81475ea29316d59254d8b957e Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Mon, 22 Aug 2022 01:19:45 +0200 Subject: term: Prevent new master while some slaves are still there The previous master may have gone before all previous slaves have gone. If a slave gets stuck, TTY_OPEN will kept set, and there would be no reset performed in open_hook, thus leaking tty state and data. --- term/ptyio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'term/ptyio.c') diff --git a/term/ptyio.c b/term/ptyio.c index fadddc16..928ae0ac 100644 --- a/term/ptyio.c +++ b/term/ptyio.c @@ -72,7 +72,7 @@ pty_open_hook (struct trivfs_control *cntl, pthread_mutex_lock (&global_lock); - if (ptyopen) + if (ptyopen || nperopens) { pthread_mutex_unlock (&global_lock); return EBUSY; -- cgit v1.2.3