This is the mail archive of the cygwin-developers@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: [corinna-cygwin@cygwin.com: Re: ENOTSOCK errors with cygwin dll 1.3.21 and 1.3.22]


Corinna Vinschen wrote:

>  Btw., on *my* box
> the problem happens in *both* cases, started from cmd as well as from
> tcsh.

OK, that kills the cygheap hypothesis.
I have confirmed the problem stems from access to the current process;
 it disappears when Everyone has access.
So we really know the root cause and the RevertToSelf solution is 
completely appropriate. 
That doesn't explain why it worked for Jason when starting from Windows. 
Perhaps his system gives wider access than Cygwin's __sec_user() does.

Glad it's over. The only embellishment I see is to move the 
fixup_before_fork_exec() call inside the winsock2_active clause, 
it is useless otherwise. Something like a self contained block.
Oops, while writing the snippet I noticed a bug. Fixed below.
  
if (winsock2_active)
    {
      fhs->set_io_handle (get_io_handle ())
      if (cygheap->user.issetuid ()) 
        RevertToSelf ();
      fhs->fixup_before_fork_exec (GetCurrentProcessId ());
      if (cygheap->user.issetuid ())
        ImpersonateLoggedOnUser (cygheap->user.token);
      fhs->fixup_after_fork (hMainProc);
      if (fhs->get_io_handle() != (HANDLE) INVALID_SOCKET)
          ^^^^^
	return 0;
      debug_printf ("WSADuplicateSocket failed, trying DuplicateHandle");
    }


Pierre


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