diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 55a38b0fa..1c4c486c6 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2012-02-10 Christopher Faylor + + * 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. + 2012-02-10 Christopher Faylor * syscalls.cc (open): Semi-revert (?) to allowing open of a tty to diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 27063ec23..539f3716f 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -1015,7 +1015,7 @@ setsid (void) syscall_printf ("hmm. pgid %d pid %d", myself->pgid, myself->pid); else { - myself->ctty = -1; + myself->ctty = -2; myself->sid = getpid (); myself->pgid = getpid (); if (cygheap->ctty) @@ -1275,7 +1275,7 @@ open (const char *unix_path, int flags, ...) tty for the process. */ int opt = PC_OPEN | ((flags & (O_NOFOLLOW | O_EXCL)) ? PC_SYM_NOFOLLOW : PC_SYM_FOLLOW); - if (!(flags & O_NOCTTY) && fd > 2 && myself->ctty > 0) + if (!(flags & O_NOCTTY) && fd > 2 && myself->ctty != -2) { flags |= O_NOCTTY; opt |= PC_CTTY; /* flag that, if opened, this fhandler could