This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: simple execvp test


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]