aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2021-04-05 07:30:07 -0500
committerRob Landley <rob@landley.net>2021-04-05 07:30:07 -0500
commitcecc41a3c52519ac1d65989b266fec32a2bd6ff7 (patch)
tree99ee765ab7b81d2eb74d62bc52fa2fe6a1bfcde9
parent6a73a3c9ee4b9e17704c368c27d0af34d785fa53 (diff)
downloadtoybox-cecc41a3c52519ac1d65989b266fec32a2bd6ff7.tar.gz
Any / in string makes it a path, not just absolute path.
Note: toy_exec() does an exact name match so fails given a path anyway, it's just an optimization to avoid the binary search, but special casing absolute path while very cheap isn't _correct_...
-rw-r--r--lib/xwrap.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/xwrap.c b/lib/xwrap.c
index 607f3c61..3f2e3f77 100644
--- a/lib/xwrap.c
+++ b/lib/xwrap.c
@@ -225,8 +225,8 @@ pid_t __attribute__((returns_twice)) xvforkwrap(pid_t pid)
void xexec(char **argv)
{
// Only recurse to builtin when we have multiplexer and !vfork context.
- if (CFG_TOYBOX && !CFG_TOYBOX_NORECURSE && toys.stacktop && **argv != '/')
- toy_exec(argv);
+ if (CFG_TOYBOX && !CFG_TOYBOX_NORECURSE)
+ if (toys.stacktop && !strchr(**argv,'/')) toy_exec(argv);
execvp(argv[0], argv);
toys.exitval = 126+(errno == ENOENT);