summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler_tty.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2012-03-03 21:35:30 +0000
committerChristopher Faylor <me@cgf.cx>2012-03-03 21:35:30 +0000
commitbd7c945953b295f263978bb6a7747d2d1b728660 (patch)
tree4dba00d30aba6f97866ccd21aa40e1e4ac7962f6 /winsup/cygwin/fhandler_tty.cc
parent56bed670461db0bd7ccbb4315b7b6b0c4e418dab (diff)
downloadcygnal-bd7c945953b295f263978bb6a7747d2d1b728660.tar.gz
cygnal-bd7c945953b295f263978bb6a7747d2d1b728660.tar.bz2
cygnal-bd7c945953b295f263978bb6a7747d2d1b728660.zip
* fhandler_console.cc (fhandler_console::dup): Only set ctty when we haven't
specifically called setsid. * fhandler_tty.cc (fhandler_pty_slave::dup): Ditto. Also add comment documenting research into rxvt problem. * fhandler_termios.cc (fhandler_termios::tcsetpgrp): Don't check specifically for myself->ctty == -1. Test for > 0 as that is the correct test. (fhandler_termios::sigflush): Ditto.
Diffstat (limited to 'winsup/cygwin/fhandler_tty.cc')
-rw-r--r--winsup/cygwin/fhandler_tty.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index b316a0aaf..547cf72b8 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -898,7 +898,16 @@ out:
int
fhandler_pty_slave::dup (fhandler_base *child, int flags)
{
- myself->set_ctty (this, flags);
+ /* This code was added in Oct 2001 for some undisclosed reason.
+ However, setting the controlling tty on a dup causes rxvt to
+ hang when the parent does a dup since the controlling pgid changes.
+ Specifically testing for -2 (ctty has been setsid'ed) works around
+ this problem. However, it's difficult to see scenarios in which you
+ have a dup'able fd, no controlling tty, and not having run setsid.
+ So, we might want to consider getting rid of the set_ctty in tty-like dup
+ methods entirely at some point */
+ if (myself->ctty != -2)
+ myself->set_ctty (this, flags);
report_tty_counts (child, "duped slave", "");
return 0;
}