Re: [xml] Building on Win32



Igor Zlatkovic wrote:

When building the latest version from anonymous CVS on WIN 32,
compilation failed on nanohttp.c because EAGAIN and EINTR are not
defined.  The following patch corrects this.


...and corrects it wrongly :-)


Hmmmm......


I have allready submitted the patch for this which corrects the problem
by including errno.h, a better way by most standards.


I dispute your assertion that I corrected this wrongly.

First point.  The test reading
        #if defined(EAGAIN) && EAGAIN != EWOULDBLOCK
was taken from elsewhere in the same file.  EAGAIN is a SYSVish error
code whereas EWOULDBLOCK is a BSDish code.  Not all systems might define
EAGAIN (though this is unlikely).  The wise thing is to check for it - at
worst it is unnecessary, however it never hurts.  Also, on some systems
EAGAIN and EWOULDBLOCK are the same value (e.g. Linux), so the test makes
sense anyway and it might as well be the one elsewhere in the code.

Second point.  On WIN 32 sockets are implemented in a seperate DLL and they
have their own set of error numbers defined in winsock2.h which are entirely
unrelated to the codes in errno.h which are for the C runtime library.  The
error code from socket_errno() cannot be compared against values from errno.h
on WIN 32 although they can on Un*x.

Finally on WIN32 select() is provided by winsock, not the C runtime so
comparing against errno after calling select is wrong anyway - it should
be socket_errno() - and this value cannot be compared with EINTR on
WIN 32 (see above).

Cheers
Brian Stafford





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]