public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: spawnvp, spawnvpe: fail if executable is not in $PATH
@ 2019-10-18 15:21 Ken Brown
0 siblings, 0 replies; only message in thread
From: Ken Brown @ 2019-10-18 15:21 UTC (permalink / raw)
To: cygwin-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=b61dc22adaf82114eee3edce91cc3433bcd27fe5
commit b61dc22adaf82114eee3edce91cc3433bcd27fe5
Author: Ken Brown <kbrown@cornell.edu>
Date: Wed Oct 9 20:06:02 2019 +0000
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.
Diff:
---
winsup/cygwin/release/3.1.0 | 3 +++
winsup/cygwin/spawn.cc | 9 ++++++---
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/winsup/cygwin/release/3.1.0 b/winsup/cygwin/release/3.1.0
index 3f2f3c8..fb0e372 100644
--- a/winsup/cygwin/release/3.1.0
+++ b/winsup/cygwin/release/3.1.0
@@ -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
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index f8090a6..f82860e 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-10-18 15:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-18 15:21 [newlib-cygwin] Cygwin: spawnvp, spawnvpe: fail if executable is not in $PATH Ken Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).