newlib-cygwin/winsup/cygwin/fhandler
Takashi Yano 8e77725f31 Cygwin: pinfo: Additional fix for CTTY behavior.
The commit 25c4ad6ea5 did not fix the CTTY behavior enough. For
example, in the following test case, TTY will be associated as
a CTTY on the second open() call even though the TTY is already
CTTY of another session. This patch fixes the issue.

  #include <unistd.h>
  #include <sys/fcntl.h>

  int main()
  {
    if (fork () == 0) {
      char *tty = ttyname(0);
      int fd;
      setsid();
      fd = open(tty, O_RDWR);
      close(fd);
      fd = open(tty, O_RDWR);
      usleep (60000000L);
    }
    return 0;
  }

Fixes: 25c4ad6ea5 ("Cygwin: pinfo: Align CTTY behavior to the
statement of POSIX.")
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-01-10 21:35:35 +09:00
..
base.cc
clipboard.cc
console.cc Cygwin: console: Make the console accessible from other terminals. 2022-12-22 21:05:31 +09:00
cygdrive.cc
dev.cc
dev_fd.cc
disk_file.cc Cygwin: stop handling files with .com suffix like .exe files 2022-10-28 12:44:27 +02:00
dsp.cc
fifo.cc Cygwin: select: don't report read ready on a FIFO never opened for writing 2022-10-19 08:17:50 -04:00
floppy.cc
mqueue.cc
netdrive.cc
nodevice.cc
null.cc
pipe.cc Cygwin: pipe: Fix performance degradation for non-cygwin pipe. 2022-12-09 21:01:29 +09:00
proc.cc fhandler/proc.cc(format_proc_cpuinfo): add Linux 6.1 cpuinfo 2022-12-23 10:03:23 +01:00
process.cc Cygwin: Correct /proc/*/stat for processes without ctty 2022-11-10 10:07:05 +01:00
process_fd.cc
procnet.cc
procsys.cc
procsysvipc.cc
pty.cc Cygwin: console: Make the console accessible from other terminals. 2022-12-22 21:05:31 +09:00
random.cc
raw.cc
registry.cc
serial.cc Cygwin: serial: Fix a copy-paste error in DTR setup 2022-11-29 11:47:27 +01:00
signalfd.cc
socket.cc
socket_inet.cc
socket_local.cc
socket_unix.cc
tape.cc
termios.cc Cygwin: pinfo: Additional fix for CTTY behavior. 2023-01-10 21:35:35 +09:00
timerfd.cc
virtual.cc
windows.cc
zero.cc