luit: Cygwin compatibility

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


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

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

     tty = open(line, O_RDWR | O_NOCTTY);

     if(tty < 0)
         goto bail;

#ifdef TIOCSCTTY
     rc = ioctl(tty, TIOCSCTTY, (char *)0);
     if(rc < 0) {
         goto bail;
     }
#endif
...

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);
+#else
      tty = open(line, O_RDWR | O_NOCTTY);
+#endif

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


Yaakov
Cygwin/X



More information about the xorg-devel mailing list