From cecc41a3c52519ac1d65989b266fec32a2bd6ff7 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Mon, 5 Apr 2021 07:30:07 -0500 Subject: 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_... --- lib/xwrap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') 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); -- cgit v1.2.3