[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-wget] Wget 1.13.4 test suite on Windows/MinGW
From: |
Giuseppe Scrivano |
Subject: |
Re: [Bug-wget] Wget 1.13.4 test suite on Windows/MinGW |
Date: |
Thu, 29 Dec 2011 18:57:10 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) |
Eli Zaretskii <address@hidden> writes:
> Sorry, I don't understand this comment. fd is indeed a file
> descriptor, but ioctlsocket's first argument is a SOCKET object, which
> is an unsigned int, and we get it from a call to `socket' or some
> such. So where do you see a potential problem?
>
> And anyway, I think wget calls ioctlsocket for every connection; if
> so, then most of those calls succeed, because the binary I built works
> and is quite capably of fetching via HTTP. So these problems seem to
> be triggered by something specific in those 3 tests.
sorry I wasn't clear. We use gnulib replacements for socket functions
so internally wget knows only about file descriptors. On Windows this
abstraction is obtained trough "_open_osfhandle" on a SOCKET object.
When we use a native function, like "ioctlsocket", we have to be sure
the file descriptor is converted back to a SOCKET object (by using
_get_osfhandle). I am afraid this conversion is not done correctly, the
value you have observed (fd = 3) let me think so.
The "w32sock.h" file from gnulib defines these two macros for such
conversions:
#define FD_TO_SOCKET(fd) ((SOCKET) _get_osfhandle ((fd)))
#define SOCKET_TO_FD(fh) (_open_osfhandle ((long) (fh), O_RDWR | O_BINARY))
Cheers,
Giuseppe