summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2012-02-10 16:43:36 +0000
committerChristopher Faylor <me@cgf.cx>2012-02-10 16:43:36 +0000
commitc38a2d83730311cad68d3c2d4759dfc18a3c64f3 (patch)
tree52d861cbb7be435aa758010c2a98f83669536281
parent93b18fd23229c9d8e50ad778f8069af9a3425e90 (diff)
downloadcygnal-c38a2d83730311cad68d3c2d4759dfc18a3c64f3.tar.gz
cygnal-c38a2d83730311cad68d3c2d4759dfc18a3c64f3.tar.bz2
cygnal-c38a2d83730311cad68d3c2d4759dfc18a3c64f3.zip
* 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.
-rw-r--r--winsup/cygwin/ChangeLog6
-rw-r--r--winsup/cygwin/syscalls.cc4
2 files changed, 8 insertions, 2 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 55a38b0fa..1c4c486c6 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,11 @@
2012-02-10 Christopher Faylor <me.cygwin2012@cgf.cx>
+ * 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 <me.cygwin2012@cgf.cx>
+
* syscalls.cc (open): Semi-revert (?) to allowing open of a tty to
become controlling tty if there is no controlling tty.
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