luit: Cygwin compatibility

Yaakov (Cygwin/X) yselkowitz at
Mon Oct 5 17:08:12 PDT 2009

We're having some issues with luit on Cygwin:  In sys.c:

openTty(char *line)
     int rc;
     int tty = -1;

     tty = open(line, O_RDWR | O_NOCTTY);

     if(tty < 0)
         goto bail;

     rc = ioctl(tty, TIOCSCTTY, (char *)0);
     if(rc < 0) {
         goto bail;

Cygwin has O_NOCTTY but no TIOCSCTTY, so the tty is never made 
controlling.  This raises two questions:

1) What is the point of O_NOCTTY if TIOCSCTTY is called right afterwards?

2) If there is a good reason for that, we could patch it:

+#ifdef __CYGWIN__
+    tty = open(line, O_RDWR);
      tty = open(line, O_RDWR | O_NOCTTY);

But if O_NOCTTY and TIOCSCTTY need to work together, should this also be 
#ifdef TIOCSCTTY instead of #ifdef __CYGWIN__?  Is this affecting other 


More information about the xorg-devel mailing list