[newlib-cygwin] Cygwin: ctty: Remove old 'kludge' code.
Takashi Yano
tyan0@sourceware.org
Tue Mar 7 02:38:15 GMT 2023
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=93f70d7849b865f2081596bbeabdd6fca6101553
commit 93f70d7849b865f2081596bbeabdd6fca6101553
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date: Sun Mar 5 18:17:39 2023 +0900
Cygwin: ctty: Remove old 'kludge' code.
Remove old 'kludge' code which does not seem necessary anymore. The
comment of the 'kludge' is as follows.
* syscalls.cc (setsid): On second thought, in the spirit of keeping
things kludgy, set ctty to -2 here as a special flag, and...
(open): ...only eschew setting O_NOCTTY when that case is detected.
Fixes: c38a2d837303
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Diff:
---
winsup/cygwin/dtable.cc | 7 -------
winsup/cygwin/syscalls.cc | 11 -----------
2 files changed, 18 deletions(-)
diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc
index 301ec8ca9..18e0f3097 100644
--- a/winsup/cygwin/dtable.cc
+++ b/winsup/cygwin/dtable.cc
@@ -764,13 +764,6 @@ dtable::dup3 (int oldfd, int newfd, int flags)
return -1;
}
- /* This is a temporary kludge until all utilities can catch up with
- a change in behavior that implements linux functionality: opening
- a tty should not automatically cause it to become the controlling
- tty for the process. */
- if (newfd > 2)
- flags |= O_NOCTTY;
-
if ((newfh = dup_worker (fds[oldfd], flags)) == NULL)
{
res = -1;
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 3908aee2e..8ae0397fb 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -1450,17 +1450,6 @@ open (const char *unix_path, int flags, ...)
int opt = PC_OPEN | PC_SYM_NOFOLLOW_PROCFD;
opt |= (flags & (O_NOFOLLOW | O_EXCL)) ? PC_SYM_NOFOLLOW
: PC_SYM_FOLLOW;
- /* This is a temporary kludge until all utilities can catch up
- with a change in behavior that implements linux functionality:
- opening a tty should not automatically cause it to become the
- controlling tty for the process. */
- if (!(flags & O_NOCTTY) && fd > 2 && myself->ctty != -2)
- {
- flags |= O_NOCTTY;
- /* flag that, if opened, this fhandler could later be capable
- of being a controlling terminal if /dev/tty is opened. */
- opt |= PC_CTTY;
- }
/* If we're opening a FIFO, we will call device_access_denied
below. This leads to a call to fstat, which can use the
More information about the Cygwin-cvs
mailing list