[corinna-cygwin@cygwin.com: Re: ENOTSOCK errors with cygwin dll 1.3.21 and 1.3.22]

Corinna Vinschen vinschen@redhat.com
Sun May 25 21:02:00 GMT 2003


Perhaps we should revert to Winsock2 duplicating and reactivate
Jason's idea to just ignore the WSAENOTSOCK from close()?

Corinna


----- Forwarded message from Corinna Vinschen <corinna-cygwin@cygwin.com> -----

> Date: Sat, 24 May 2003 11:15:56 +0200
> From: Corinna Vinschen <corinna-cygwin@cygwin.com>
> Subject: Re: ENOTSOCK errors with cygwin dll 1.3.21 and 1.3.22
> To: cygwin@cygwin.com
> Reply-To: cygwin@cygwin.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 really
> > seem to find anything, other than an MS KB 150523 "BUG: Socket Inheritance
> > on Different Windows Platforms".  I don't mind investigating further, but I
> > think I've come to a roadblock....  In the comment with the patch, it says
> > "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:cygwin@cygwin.com
Red Hat, Inc.



More information about the Cygwin-developers mailing list