[CF-Devel] More on the socket bug

Mark Wedel mwedel at sonic.net
Sun Aug 25 23:49:56 CDT 2002


Kurt Fitzner wrote:
>
     
      I think I figured out the issue with the sockets on HPUX.  In socket/init.c
     
     >
     
      the file descriptor is opened in O_NDELAY mode.  In Linux O_NDELAY and
     
     >
     
      O_NONBLOCK are the same.  In other implementations, it's not.  In O_NDELAY
     
     >
     
      mode, read()s return a zero if there is no data on a pipe (sockets are treated
     
     >
     
      as pipes).  It also returns a zero if there is no writer open on the pipe. 
     
     >
     
      So, it becomes impossible to tell the difference.
     
     >
     
     
     >
     
      I suggest changing O_NDELAY in socket/init.c InitConnection() to O_NONBLOCK. 
     
     >
     
      This will cause read()s where there is no data to return a -1 with errno set
     
     >
     
      to EAGAIN.
     
     
  I'm going to make that change to the source.  The behaviour with 
nonblock/ndelay also appears on solaris, and probably only svr4 compliant system.




    
    


More information about the crossfire mailing list