"Hrvoje Niksic" <[EMAIL PROTECTED]> said:
> #ifdef WINDOWS
> # define select(a, b, c, d) windows_select (a, b, c, d)
> #endif
Okay by me.
> #ifndef ENOTCONN
> # define ENOTCONN X_ENOTCONN
> #endif
Except you cannot make Winsock return X_ENOTCONN.
It returns WSAENOTCONN (def'ed to ENOTCONN in
mswindows.h). Winsock errors are in the range
WSABASEERR (10000) to 11031 with some holes in
the range.
> const char *
> windows_strerror (int err)
> {
> /* Leave the standard ones to strerror. */
> if (err < X_ERRBASE)
> return strerror (err);
>
> /* Handle the unsupported ones manually. */
> switch (err)
> {
> case X_ENOTCONN:
> return "Connection refused";
Which AFAICS is the pretty much the same as in my patch.
Another thing is that Wget could mask errnos for Unix
too. In connect.c:
...
{
CLOSE (sock);
sock = -1;
goto out;
}
out:
...
else
{
save_errno = errno;
if (!silent)
logprintf (LOG_VERBOSE, "failed: %s.\n", strerror (errno));
errno = save_errno;
}
The close() could possibly set errno too, but we want the errno
from bind() or connect() don't we?
--gv