From eebd3f7d4732bd2e1b13041b5d0253f532865a11 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sat, 19 Apr 2008 00:02:05 +0000 Subject: [PATCH] * Don't check the open count of the other tty anymore when acquiring a reference. The places where that is of relevance do that anyway, and tty_ioctl(), where it isn't, failed before, although that was not necessary. This prevented for instance ioctls() on the master tty before any slave had been opened. * If the tty has no process group set, don't check for background reads. This was a problem with telnetd, respectively the executed login, which couldn't access the tty, since telnetd makes sure neither itself nor login has a controlling tty. telnet still doesn't work, exactly because it has no controlling tty and cannot set the tty process group. Not sure how that is supposed to work. Furthermore the tty doesn't have the usual flags set, which is apparrently the reason for the workaround (read_string()) in login. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25038 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/drivers/tty/tty.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/add-ons/kernel/drivers/tty/tty.cpp b/src/add-ons/kernel/drivers/tty/tty.cpp index d86834dbdc..acb31a6503 100644 --- a/src/add-ons/kernel/drivers/tty/tty.cpp +++ b/src/add-ons/kernel/drivers/tty/tty.cpp @@ -147,7 +147,7 @@ class TTYReferenceLocking { { MutexLocker _(gTTYCookieLock); - if (cookie->closed || cookie->other_tty->open_count == 0) + if (cookie->closed) return false; cookie->thread_count++; @@ -626,7 +626,8 @@ WriterLocker::_CheckBackgroundWrite() const } pid_t processGroup = getpgid(0); - if (processGroup != fSource->settings->pgrp_id) { + if (fSource->settings->pgrp_id != 0 + && processGroup != fSource->settings->pgrp_id) { if (team_get_controlling_tty() == fSource->index) send_signal(-processGroup, SIGTTOU); return EIO; @@ -730,7 +731,8 @@ ReaderLocker::_CheckBackgroundRead() const return B_OK; pid_t processGroup = getpgid(0); - if (processGroup != fTTY->settings->pgrp_id) { + if (fTTY->settings->pgrp_id != 0 + && processGroup != fTTY->settings->pgrp_id) { if (team_get_controlling_tty() == fTTY->index) send_signal(-processGroup, SIGTTIN); return EIO;