Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Wed, 22 May 2002 12:59:21 -0400 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: Bug: fhandler.cc rev=1.116 source code level bug in fhandler_base::dup (fhandler_base *child) Message-ID: <20020522165921.GB3592@redhat.com> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <001101c201a8$2148fc40$df250b93 AT ALASTIMSON> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <001101c201a8$2148fc40$df250b93@ALASTIMSON> User-Agent: Mutt/1.3.23.1i On Wed, May 22, 2002 at 08:48:33AM -0700, Leo Kuznetsov wrote: >Hi, > >I might be wrong but it looks like: > >In the function below >------------------------ > if (get_nohandle ()) > nh = NULL; // NULL == 0 and is a valid (but possibly closed) handle > >------------------------ >MUST BE >------------------------ > if (get_nohandle ()) > nh = (HANDLE)-1; // or better yet INVALID_HANDLE_VALUE > >========================= >Otherwise dup(dup(-1)) == dup(0) and >sets an error if handle 0 is closed. >(This is excatly the case with recursive invocation >of gmake jobs with stdio redirected to pipes)... 1) What's "gmake"? 2) Why shouldn't it "set an error" if handle 0 is closed? 3) Why would anyone do a dup(dup(-1))? 4) Why would setting nh to anything affect this code? This code path is only invoked for /cygdrive or /proc style paths. If you have a specific problem, you should provide a test case. I don't see any problems with recursive invocation of gmake jobs with stdio. cgf >--------------------------------- > >FILE: fhandler.cc >LINE: ~886 > >int >fhandler_base::dup (fhandler_base *child) >{ > debug_printf ("in fhandler_base dup"); > > HANDLE nh; > if (get_nohandle ()) > nh = NULL; > else if (!DuplicateHandle (hMainProc, get_handle(), hMainProc, &nh, 0, TRUE, >DUPLICATE_SAME_ACCESS)) > { > system_printf ("dup(%s) failed, handle %x, %E", > get_name (), get_handle()); > __seterrno (); > return -1; > } > > child->set_io_handle (nh); > return 0; >} > > > >-- >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/ -- 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/