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 10:09:07 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: fcntl(F_SETFD) on a file or socket handle Message-ID: <20010920100907.D4194@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> <20010920090219 DOT A4194 AT cygbert DOT vinschen DOT de> <003601c141a8$8adc7760$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: <003601c141a8$8adc7760$d2823bd5@dmitry>; from dmitry@baikal.ru on Thu, Sep 20, 2001 at 04:46:47PM +0900 On Thu, Sep 20, 2001 at 04:46:47PM +0900, Dmitry Timoshkov wrote: > "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). set_close_on_exec() is a virtual method which means, the called method is dependent of the actual class of the object which calls it. Did you get the sources of Cygwin via CVS? If so, could you please check if my just checked in patch works for you? 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/