Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@sources.redhat.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@sources.redhat.com>
List-Help: <mailto:cygwin-help@sources.redhat.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@sources.redhat.com
Delivered-To: mailing list cygwin@sources.redhat.com
Message-ID: <3BCFFB48.1E2B85F7@syntrex.com>
Date: Fri, 19 Oct 2001 12:07:04 +0200
From: Pavel Tsekov <ptsekov@syntrex.com>
Organization: Syntrex Inc.
X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.4.2-2 i686)
X-Accept-Language: en
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: simple execvp test
References: <3BCECA31.4FE7AAD2@syntrex.com> <20011018171144.B19399@redhat.com> <3BCFF639.B4F5CF47@syntrex.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Pavel Tsekov wrote:
> 
> I'm looking at the spawn_guts code to see if
> there is something in this setup which may
> broke execvp.
> 

Btw I found something which may broke spawn_guts,
though I dont think this is the case with
James - see below:

This code is from spawn_guts - the interesting thing
about it is that it doesn set the errno (__seterrno())
if the DuplicateHandle doesnt succeed. All the other
Win32 apis which a called though the spawn_guts set
the errno if they fail.

So if we have execvp which loops through the PATH while
it finds the executable thus executing spawn_guts many
times most of which it fails with ENOENT and if spawn_guts
fail to duplicate handle the errno will still be set to
ENOENT which is not correct, maybe :)

  if (!DuplicateHandle (hMainProc, hMainProc, hMainProc,
&ciresrv.parent, 0, 1,
                        DUPLICATE_SAME_ACCESS))
     {
       system_printf ("couldn't create handle to myself for child, %E");
       return -1;
     }

--
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/

