⛏️ index : haiku.git

author Jérôme Duval <jerome.duval@gmail.com> 2022-11-26 16:56:56.0 +01:00:00
committer waddlesplash <waddlesplash@gmail.com> 2022-11-27 19:54:04.0 +00:00:00
commit
b782f25f6eac8a048e30870e7d57f7cfd4b2c2a4 [patch]
tree
9fa9add634ad4ee03e903597b3061b7809ce4688
parent
3cf6e0dc24e438543e3d9ba9f2ee1e91b71e7bac
download
b782f25f6eac8a048e30870e7d57f7cfd4b2c2a4.tar.gz

tty: let processes open a slave tty again, ignoring O_NOCTTY.

they just won't control the tty.
fixes https://github.com/haikuports/haikuports/issues/7457

Change-Id: I8968b620a39c3050f6498faaa95c25aaed86e5c1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5832
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
(cherry picked from commit 685e124c99b4492d7ee494d6be96801b26f1bcfd)
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5838

Diff

 src/add-ons/kernel/drivers/tty/slave.cpp | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/add-ons/kernel/drivers/tty/slave.cpp b/src/add-ons/kernel/drivers/tty/slave.cpp
index 52684df..ef0d560 100644
--- a/src/add-ons/kernel/drivers/tty/slave.cpp
+++ b/src/add-ons/kernel/drivers/tty/slave.cpp
@@ -71,11 +71,9 @@
		}
	} else if (makeControllingTTY) {
		// If already open, we allow only processes from the same session
		// to open the tty again.
		// to open the tty again while becoming controlling tty
		pid_t ttySession = gSlaveTTYs[index].settings->session_id;
		if (ttySession >= 0) {
			if (ttySession != sessionID)
				return B_NOT_ALLOWED;
			makeControllingTTY = false;
		} else {
			// The tty is not associated with a session yet. The process needs