[gpm]open trick

Anders Torger torger@ludd.luth.se
Sat, 4 Jan 2003 23:48:29 +0100

When studying the gpm code, I notice that the mouse fd is opened first 
with O_NDELAY, and then directly after it is reset using fcntl, like 

      if(!strcmp(opt_dev,"-")) fd=0; /* use stdin */
      else if( (fd=open(opt_dev,O_RDWR | O_NDELAY)) < 0)
      /* and then reset the flag */
      fcntl(fd,F_SETFL,fcntl(fd,F_GETFL) & ~O_NDELAY);

I really curious about why this is done.

/Anders Torger