[PATCH] Cygwin: pinfo: Additional fix for CTTY behavior.

Takashi Yano takashi.yano@nifty.ne.jp
Tue Jan 10 13:37:06 GMT 2023


On Mon, 9 Jan 2023 10:25:33 +0100
Corinna Vinschen wrote:
> Also, given this was a "kludge" from 10 years ago, is it really still
> needed?

Ah, do you mean the "kludge":
winsup/cygwin/syscalls.cc: 1455:
      /* 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;
	}

and

winsup/cygwin/dtable.cc: 767:
  /* 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;
?

These codes might be able to be deleted. I'll check if these
are not needed.

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>


More information about the Cygwin-patches mailing list