Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Date: Thu, 20 Sep 2001 09:02:19 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: fcntl(F_SETFD) on a file or socket handle Message-ID: <20010920090219.A4194@cygbert.vinschen.de> Mail-Followup-To: cygwin AT cygwin DOT com References: <077d01c1400e$2d92cdc0$d2823bd5 AT dmitry> <20010918101238 DOT H22900 AT cygbert DOT vinschen DOT de> <008501c14183$d9eddc10$d2823bd5 AT dmitry> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <008501c14183$d9eddc10$d2823bd5@dmitry>; from dmitry@baikal.ru on Thu, Sep 20, 2001 at 12:24:06PM +0900 On Thu, Sep 20, 2001 at 12:24:06PM +0900, Dmitry Timoshkov wrote: > "Corinna Vinschen" wrote: > > [skipped] > > > > I didn't investigate it further, and probably will not have time in the near > > > future to do so. Sorry. > > > > :-( > > > > You could at least send a testcase if you don't want to debug it. > > Analyzing Cygwin code, it seems I have found the source of the problem (had no > time to confirm it running offending code though). > > It's in the fhandler_base::set_inheritance() called from fhandler_base::set_close_on_exec(). > > DuplicateHandle()/CloseHandle() invalidates original system handle associated > with the Cygwin internal file descriptor (fd) while an operation on the fd is > possibly still in progress. Thanks for the hint. That should unlikely be the cause, except you're running plain win95. If you take a look into fhandler_socket.cc, you'll see that the fhandler_socket class defines it's own set_close_on_exec() method which doesn't call set_inheritance() when running Winsock2. OTOH, there seem to be a bug in 1.3.2 which could result in using Winsock1.1 methods even if Winsock2 is available. Hmm, but the cause should be exactly the other way around: Due to the error, Winsock1.1 methods are used for inheritance but w/o calling set_inheritance() before... However, you're reporting that problem is in the snapshots as well... Are you using win95, perhaps? Could you please start the application under strace and check, which Winsock version is used? Just look for a block of lines with the text "wsock_init" like that: 2326 339805 [main] ssh-agent 1760 wsock_init: res 0 157 339962 [main] ssh-agent 1760 wsock_init: wVersion 514 81 340043 [main] ssh-agent 1760 wsock_init: wHighVersion 514 78 340121 [main] ssh-agent 1760 wsock_init: szDescription WinSock 2.0 78 340199 [main] ssh-agent 1760 wsock_init: szSystemStatus Running 77 340276 [main] ssh-agent 1760 wsock_init: iMaxSockets 0 74 340350 [main] ssh-agent 1760 wsock_init: iMaxUdpDg 0 74 340424 [main] ssh-agent 1760 wsock_init: lpVendorInfo 0 Thanks, Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Developer mailto:cygwin AT cygwin DOT com Red Hat, Inc. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/