This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ENOTSOCK errors with cygwin dll 1.3.21 and 1.3.22


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.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]