Mailing-List: contact cygwin-developers-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-developers-owner AT cygwin DOT com Delivered-To: mailing list cygwin-developers AT cygwin DOT com Message-ID: <3E68ADBF.77EF953F@ieee.org> Date: Fri, 07 Mar 2003 09:33:35 -0500 From: "Pierre A. Humblet" X-Accept-Language: en,pdf MIME-Version: 1.0 To: cygwin-developers AT cygwin DOT com Subject: Re: Winsock closesocket() problem References: <20030306144658 DOT GB2008 AT tishler DOT net> <3E6762CA DOT 8EF5B6A8 AT ieee DOT org> <20030306154047 DOT GC2008 AT tishler DOT net> <20030307131445 DOT GC20194 AT cygbert DOT vinschen DOT de> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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