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 Message-ID: <003601c141a8$8adc7760$d2823bd5@dmitry> From: "Dmitry Timoshkov" To: References: <077d01c1400e$2d92cdc0$d2823bd5 AT dmitry> <20010918101238 DOT H22900 AT cygbert DOT vinschen DOT de> <008501c14183$d9eddc10$d2823bd5 AT dmitry> <20010920090219 DOT A4194 AT cygbert DOT vinschen DOT de> Subject: Re: fcntl(F_SETFD) on a file or socket handle Date: Thu, 20 Sep 2001 16:46:47 +0900 MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 "Corinna Vinschen" wrote: > > 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. I see that fhandler_socket::fcntl() calls fhandler_base::fcntl() in all cases different from F_SETFL. Perhaps my understanding of things in C++ is not enough (I'm an old hand plain C programmer). > 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? No, I'm using Win2000 SP2. > 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 I have the same numbers as in your trace. -- Dmitry. -- 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/