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>
This commit is contained in:
Jérôme Duval 2022-11-26 16:56:56 +01:00
parent 17ec9b7f4e
commit 685e124c99

View File

@ -71,11 +71,9 @@ slave_open(const char *name, uint32 flags, void **_cookie)
}
} 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