[CF-Devel] More on the socket bug

Kurt Fitzner kf_bulk at excelcia.org
Sun Aug 25 13:35:54 CDT 2002


I think I figured out the issue with the sockets on HPUX.  It may affect
other *NIXes as well. 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.

        Kurt.


    
    


More information about the crossfire mailing list