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: Winsock closesocket() problem


Corinna Vinschen wrote:
> 
> On Thu, Mar 06, 2003 at 10:40:47AM -0500, Jason Tishler wrote:
> > On Thu, Mar 06, 2003 at 10:01:30AM -0500, Pierre A. Humblet wrote:
> > > Jason Tishler wrote:
> > > > Note that the problem follows the second close().  If I switch the
> > > > order of the close() calls, then dup()-ed socket closes without any
> > > > errors.  Hence, I don't believe that this problem is directly
> > > > related to dup().
> > >
> > > and then closing the original socket fails. Correct?
> >
> > Yes, with the above change I get the following:
> >
> >     $ sc9
> >     close(fd) failed with 108
> 
> I debugged this situation and I have good news for you:  You are not
> alone.  I also have not the faintest idea what goes on :-(
> 
> I even tried reverting the uid/gid to SYSTEM but it still fails in the
> same way.

Where in the code did you revert? Did you try setting the gid to Admins?

> And as you wrote, running under gdb or strace, everything's fine. 

My hypothesis about that is that strace starts everyting fresh from
Windows. Otherwise we start from (ba)sh (or cygrunsrv), which may have
setup/opened "things" for us. 
If this is true then the problem should reappear with
  strace sh -c 'hostname ; the_test_case.exe '
(hostname may or may not be needed)

> Removing the setgroups() call doesn't change anything.  But removing
> one of setuid/setgid let the error disappear.

That's strange because in Jason's environment 4.10 works fine. The main
difference is that there is no setgroups() in 4.10. Also the close order
is reversed, but that doesn't seem to matter.
With everything the token has groups 1009 (+ Everyone of course) 
Without the setgroups, the token has (I think) Users + 1009
Without the setgid but with setgroups, the token has Admins
So it may be a question of rights of Admins vs. rights of Users in your
environment.

Pierre


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