[PATCH] luit: Cygwin compatibility fix
Alan Coopersmith
Alan.Coopersmith at Sun.COM
Tue Oct 6 10:59:02 PDT 2009
Do you need the defined(__CYGWIN__) or should it just be:
#if !defined(O_NOCTTY) || !defined(TIOCSCTTY)
?
-alan-
Yaakov (Cygwin/X) wrote:
> From: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
>
> 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 <yselkowitz at users.sourceforge.net>
> ---
> 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;
--
-Alan Coopersmith- alan.coopersmith at sun.com
Sun Microsystems, Inc. - X Window System Engineering
More information about the xorg-devel
mailing list