From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7868) id B260E38555A2; Tue, 7 Mar 2023 02:38:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B260E38555A2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1678156695; bh=TRNMYJrDx09f9e1DE5e+rQbV0jMtNJS7EibUDHEazX0=; h=From:To:Subject:Date:From; b=UptdpSkBXjmFVQbscO6s6Q7XKW+LoVvlTRVIxODOoLmjSsItJ/lNL6MW66xQIBw27 SI8IApKYtMAoyjz5lJep6NSyCAnNNbEi+TVKXbKE5RCaeGrav542MV5uqwgmV91v04 wgybUvpdND+HFoCGSnkiU4zdi3BHMkQ+MOdyN6ro= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Takashi Yano To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: ctty: Remove old 'kludge' code. X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano X-Git-Refname: refs/heads/master X-Git-Oldrev: 13a84ac79b1c8e7e6aa3c7a2444ae2cbbe5ee430 X-Git-Newrev: 93f70d7849b865f2081596bbeabdd6fca6101553 Message-Id: <20230307023815.B260E38555A2@sourceware.org> Date: Tue, 7 Mar 2023 02:38:15 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D93f70d7849b= 865f2081596bbeabdd6fca6101553 commit 93f70d7849b865f2081596bbeabdd6fca6101553 Author: Takashi Yano Date: Sun Mar 5 18:17:39 2023 +0900 Cygwin: ctty: Remove old 'kludge' code. =20 Remove old 'kludge' code which does not seem necessary anymore. The comment of the 'kludge' is as follows. =20 * 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. =20 Fixes: c38a2d837303 Signed-off-by: Takashi Yano 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; } =20 - /* 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 |=3D O_NOCTTY; - if ((newfh =3D dup_worker (fds[oldfd], flags)) =3D=3D NULL) { res =3D -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 =3D PC_OPEN | PC_SYM_NOFOLLOW_PROCFD; opt |=3D (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 !=3D -2) - { - flags |=3D O_NOCTTY; - /* flag that, if opened, this fhandler could later be capable - of being a controlling terminal if /dev/tty is opened. */ - opt |=3D PC_CTTY; - } =20 /* If we're opening a FIFO, we will call device_access_denied below. This leads to a call to fstat, which can use the