Re: [gtk-vnc-devel] [PATCH 3/4] Use Gnulib ioctl instead of ioctlsocket
- From: "Daniel P. Berrange" <berrange redhat com>
- To: "Richard W.M. Jones" <rjones redhat com>
- Cc: gtk-vnc-devel lists sourceforge net
- Subject: Re: [gtk-vnc-devel] [PATCH 3/4] Use Gnulib ioctl instead of ioctlsocket
- Date: Thu, 30 Oct 2008 14:59:50 +0000
On Wed, Oct 29, 2008 at 03:07:08PM +0000, Richard W.M. Jones wrote:
>
> This patch isn't necessary for Windows itself, but is important for
> Wine. Wine apparently contains a bug where calls to ioctlsocket fail
> because it tries to interpret the first parameter as a handle.[1]
>
> This calls Gnulib's replacement ioctl function instead. It also
> rearranges the code so that the normal Unix case is first, and the
> Windows case second. Also it uses WIN32 instead of __MINGW32__ as
> explained in patch 1/4.
>
> Rich.
>
> [1] Actually, I'm not totally sure this analysis is correct -- it's
> very hard to follow what the code is doing and what it's supposed to
> be doing. Furthermore the concept of file descriptor vs socket vs
> handle is very confused on Windows itself. In any case, this patch is
> still necessary to run gvncviewer.exe under Wine.
The bug isn't actually in WINE. The issue is that on Windows a socket
handle is not the same as a file handle. Winsock's socket() API
gives you back a socket handle, so using ioctlsocket() would be correct.
We're using GNULIB though, and this wraps Winsock's socket() API so
that it gives us back a true file handle as per POSIX. We were then
passing the file handle into ioctlsocket() which expects a socket
handle. Anyway enough rambling, your patch is doing the correct
thing and calling ioctl() which gnulib does translation for.
Daniel
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]