Cygwin: spawnvp, spawnvpe: fail if executable is not in $PATH
Call find_exec with the FE_NNF flag to enforce a NULL return when the executable isn't found in $PATH. Convert NULL to "". This aligns spawnvp and spawnvpe with execvp and execvpe.
This commit is contained in:
parent
43d7f33e2c
commit
b61dc22ada
|
@ -91,3 +91,6 @@ Bug Fixes
|
|||
- If the argument to mkdir(2) or rmdir(2) is 'x:\', don't strip the
|
||||
trailing backslash.
|
||||
Addresses: https://cygwin.com/ml/cygwin/2019-08/msg00334.html
|
||||
|
||||
- Make spawnvp, spawnvpe fail if the executable is not in $PATH.
|
||||
Addresses: https://cygwin.com/ml/cygwin/2019-10/msg00032.html
|
||||
|
|
|
@ -1081,8 +1081,9 @@ extern "C" int
|
|||
spawnvp (int mode, const char *file, const char * const *argv)
|
||||
{
|
||||
path_conv buf;
|
||||
return spawnve (mode | _P_PATH_TYPE_EXEC, find_exec (file, buf), argv,
|
||||
cur_environ ());
|
||||
return spawnve (mode | _P_PATH_TYPE_EXEC,
|
||||
find_exec (file, buf, "PATH", FE_NNF) ?: "",
|
||||
argv, cur_environ ());
|
||||
}
|
||||
|
||||
extern "C" int
|
||||
|
@ -1090,7 +1091,9 @@ spawnvpe (int mode, const char *file, const char * const *argv,
|
|||
const char * const *envp)
|
||||
{
|
||||
path_conv buf;
|
||||
return spawnve (mode | _P_PATH_TYPE_EXEC, find_exec (file, buf), argv, envp);
|
||||
return spawnve (mode | _P_PATH_TYPE_EXEC,
|
||||
find_exec (file, buf, "PATH", FE_NNF) ?: "",
|
||||
argv, envp);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
Loading…
Reference in New Issue