From: Yaakov Selkowitz <[email protected]> Cygwin has O_NOCTTY but not TIOCSCTTY, so there is no way for the tty to become controlling this way. Also, document the reason for calling one right after the other.
Signed-off-by: Yaakov Selkowitz <[email protected]> --- sys.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/sys.c b/sys.c index ba60fbf..cc79645 100644 --- a/sys.c +++ b/sys.c @@ -408,7 +408,17 @@ openTty(char *line) int rc; int tty = -1; +#if defined(__CYGWIN__) && !defined(TIOCSCTTY) + /* Cygwin currently) has O_NOCTTY but not TIOCSCTTY, so the tty + never becomes controlling */ + tty = open(line, O_RDWR); +#else + /* The TIOCSCTTY ioctl below will fail if the process already has a + controlling tty (even if the current controlling tty is the same + as the tty you want to make controlling). So we need to open + the tty with O_NOCTTY to make sure this doesn't happen. */ tty = open(line, O_RDWR | O_NOCTTY); +#endif if(tty < 0) goto bail; -- 1.6.4.2 _______________________________________________ xorg-devel mailing list [email protected] http://lists.x.org/mailman/listinfo/xorg-devel
