[email@example.com: Re: ENOTSOCK errors with cygwin dll 1.3.21 and 1.3.22]
Pierre A. Humblet
Sun May 25 21:27:00 GMT 2003
At 11:30 AM 5/24/2003 +0200, Corinna Vinschen wrote:
>Perhaps we should revert to Winsock2 duplicating and reactivate
>Jason's idea to just ignore the WSAENOTSOCK from close()?
It's more complicated than that. The old behavior is that the dup
was failing silently and returning the dupeed (old) handle instead
of a duped (new) one. That's not acceptable IMO, dup should fail
if it can't do what it's supposed to.
Later the program was closing both the old and new handles,
with the second close failing (as it should).
I would like to better understand what's going on, at least until
we are close to a release.
>----- Forwarded message from Corinna Vinschen <firstname.lastname@example.org>
>> Date: Sat, 24 May 2003 11:15:56 +0200
>> From: Corinna Vinschen <email@example.com>
>> Subject: Re: ENOTSOCK errors with cygwin dll 1.3.21 and 1.3.22
>> To: firstname.lastname@example.org
>> Reply-To: email@example.com
>> On Fri, May 23, 2003 at 12:44:57PM -0700, Abraham Backus wrote:
>> > Specifically:
>> > * fhandler_socket.cc (fhandler_socket::dup): On NT systems avoid
>> > using WinSock2 socket duplication methods. Add comment.
>> > This is what's causing me grief.
>> > I built the 1.3.22 sources, commenting out the line:
>> > if (! wincap.has_security ())
>> > and my inetd apps work ok again.
>> > I've been searching the web and archives to try and find out what's the
>> > difference between WSADuplicateSocket and DuplicateHandle and I can't
>> > seem to find anything, other than an MS KB 150523 "BUG: Socket
>> > on Different Windows Platforms". I don't mind investigating further,
>> > think I've come to a roadblock.... In the comment with the patch, it
>> > "Using WinSock2 methods for dup'ing sockets seem to collide with user
>> > context switches under... some... conditions." Where can I find more
>> > information on this user context collision problem?
>> There's discussion on the cygwin-developers list. Basically what
>> happened (before the above change was applied) was this:
>> Start the following under SYSTEM account:
>> fd = socket ();
>> setuid (non-privileged-account);
>> fd2 = dup (fd);
>> close (fd2); <-- returns WSAENOTSOCK
>> For some reason this does not happen if the process is started from a
>> native windows process (e.g. cmd.exe) but it happens when the process
>> is started from another Cygwin process. We still don't know why that
>> happens (therefore the "...some..." comment) but using simple socket
>> handle duplication instead of WinSock2 WSASocket/WSADuplicateSocket
>> when duplication a socket resolved that problem.
>> > I have WinXP Home SP1.
>> Me, too. And note that it works for me!
>> There was only one socket problem reported for Windows XP so far,
>> KB article 319952 but it doesn't seem to be related. Sic.
>----- End forwarded message -----
>Corinna Vinschen Please, send mails regarding Cygwin to
>Cygwin Developer mailto:firstname.lastname@example.org
>Red Hat, Inc.
More information about the Cygwin-developers