---- a/Config.in
-+++ b/Config.in
-@@ -431,13 +431,10 @@ config FEATURE_PREFER_APPLETS
-
- config BUSYBOX_EXEC_PATH
- string "Path to BusyBox executable"
-- default "/proc/self/exe"
-+ default "/bin/busybox"
- help
- When Busybox applets need to run other busybox applets, BusyBox
-- sometimes needs to exec() itself. When the /proc filesystem is
-- mounted, /proc/self/exe always points to the currently running
-- executable. If you haven't got /proc, set this to wherever you
-- want to run BusyBox from.
-+ sometimes needs to exec() itself.
+--- a/shell/ash.c
++++ b/shell/ash.c
+@@ -7394,23 +7394,8 @@ static int builtinloc = -1; /* index
- # These are auto-selected by other options
---- a/coreutils/chroot.c
-+++ b/coreutils/chroot.c
-@@ -41,5 +41,7 @@ int chroot_main(int argc UNUSED_PARAM, c
- /*argv[2] = NULL; - already is */
- }
-
-- BB_EXECVP_or_die(argv);
-+ execvp(argv[0], argv);
-+ xfunc_error_retval = (errno == ENOENT) ? 127 : 126;
-+ bb_perror_msg_and_die("can't execute '%s'", argv[0]);
- }
---- a/include/libbb.h
-+++ b/include/libbb.h
-@@ -896,13 +896,11 @@ int exists_execable(const char *filename
- * but it may exec busybox and call applet instead of searching PATH.
- */
- #if ENABLE_FEATURE_PREFER_APPLETS
-+int bb_execv_applet(const char *name, char *const argv[], char *const envp[]) FAST_FUNC;
- int BB_EXECVP(const char *file, char *const argv[]) FAST_FUNC;
--#define BB_EXECLP(prog,cmd,...) \
-- do { \
-- if (find_applet_by_name(prog) >= 0) \
-- execlp(bb_busybox_exec_path, cmd, __VA_ARGS__); \
-- execlp(prog, cmd, __VA_ARGS__); \
-- } while (0)
-+int bb_execlp(const char *file, const char *arg, ...) FAST_FUNC;
-+#define BB_EXECVP(prog,cmd) bb_execvp(prog,cmd)
-+#define BB_EXECLP(prog,cmd,...) bb_execlp(prog,cmd, __VA_ARGS__)
- #else
- #define BB_EXECVP(prog,cmd) execvp(prog,cmd)
- #define BB_EXECLP(prog,cmd,...) execlp(prog,cmd,__VA_ARGS__)
-@@ -1683,6 +1681,7 @@ extern const char bb_path_wtmp_file[];
+ static void
+-tryexec(IF_FEATURE_SH_STANDALONE(int applet_no,) char *cmd, char **argv, char **envp)
++tryexec(char *cmd, char **argv, char **envp)
+ {
+-#if ENABLE_FEATURE_SH_STANDALONE
+- if (applet_no >= 0) {
+- if (APPLET_IS_NOEXEC(applet_no)) {
+- clearenv();
+- while (*envp)
+- putenv(*envp++);
+- run_applet_no_and_exit(applet_no, argv);
+- }
+- /* re-exec ourselves with the new arguments */
+- execve(bb_busybox_exec_path, argv, envp);
+- /* If they called chroot or otherwise made the binary no longer
+- * executable, fall through */
+- }
+-#endif
+-
+ repeat:
+ #ifdef SYSV
+ do {
+@@ -7465,24 +7450,21 @@ shellexec(char **argv, const char *path,
+ int e;
+ char **envp;
+ int exerrno;
+-#if ENABLE_FEATURE_SH_STANDALONE
+- int applet_no = -1;
+-#endif
- #define bb_dev_null "/dev/null"
- extern const char bb_busybox_exec_path[];
-+extern const char *bb_busybox_exec_paths[];
- /* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin,
- * but I want to save a few bytes here */
- extern const char bb_PATH_root_path[]; /* "PATH=/sbin:/usr/sbin:/bin:/usr/bin" */
+ clearredir(/*drop:*/ 1);
+ envp = listvars(VEXPORT, VUNSET, /*end:*/ NULL);
+- if (strchr(argv[0], '/') != NULL
+-#if ENABLE_FEATURE_SH_STANDALONE
+- || (applet_no = find_applet_by_name(argv[0])) >= 0
+-#endif
+- ) {
+- tryexec(IF_FEATURE_SH_STANDALONE(applet_no,) argv[0], argv, envp);
++ if (strchr(argv[0], '/') != NULL) {
++ tryexec(argv[0], argv, envp);
+ e = errno;
+ } else {
++#if ENABLE_FEATURE_SH_STANDALONE
++ bb_execv_applet(argv[0], argv, envp);
++#endif
++
+ e = ENOENT;
+ while ((cmdname = path_advance(&path, argv[0])) != NULL) {
+ if (--idx < 0 && pathopt == NULL) {
+- tryexec(IF_FEATURE_SH_STANDALONE(-1,) cmdname, argv, envp);
++ tryexec(cmdname, argv, envp);
+ if (errno != ENOENT && errno != ENOTDIR)
+ e = errno;
+ }
--- a/libbb/execable.c
+++ b/libbb/execable.c
@@ -9,6 +9,9 @@
const char bb_default_login_shell[] ALIGN1 = LIBBB_DEFAULT_LOGIN_SHELL;
/* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin,
* but I want to save a few bytes here. Check libbb.h before changing! */
---- a/shell/ash.c
-+++ b/shell/ash.c
-@@ -7394,22 +7394,8 @@ static int builtinloc = -1; /* index
+--- a/include/libbb.h
++++ b/include/libbb.h
+@@ -896,13 +896,11 @@ int exists_execable(const char *filename
+ * but it may exec busybox and call applet instead of searching PATH.
+ */
+ #if ENABLE_FEATURE_PREFER_APPLETS
+-int BB_EXECVP(const char *file, char *const argv[]) FAST_FUNC;
+-#define BB_EXECLP(prog,cmd,...) \
+- do { \
+- if (find_applet_by_name(prog) >= 0) \
+- execlp(bb_busybox_exec_path, cmd, __VA_ARGS__); \
+- execlp(prog, cmd, __VA_ARGS__); \
+- } while (0)
++int bb_execv_applet(const char *name, char *const argv[], char *const envp[]) FAST_FUNC;
++int bb_execvp(const char *file, char *const argv[]) FAST_FUNC;
++int bb_execlp(const char *file, const char *arg, ...) FAST_FUNC;
++#define BB_EXECVP(prog,cmd) bb_execvp(prog,cmd)
++#define BB_EXECLP(prog,cmd,...) bb_execlp(prog,cmd, __VA_ARGS__)
+ #else
+ #define BB_EXECVP(prog,cmd) execvp(prog,cmd)
+ #define BB_EXECLP(prog,cmd,...) execlp(prog,cmd,__VA_ARGS__)
+@@ -1683,6 +1681,7 @@ extern const char bb_path_wtmp_file[];
+ #define bb_dev_null "/dev/null"
+ extern const char bb_busybox_exec_path[];
++extern const char *bb_busybox_exec_paths[];
+ /* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin,
+ * but I want to save a few bytes here */
+ extern const char bb_PATH_root_path[]; /* "PATH=/sbin:/usr/sbin:/bin:/usr/bin" */
+--- a/Config.in
++++ b/Config.in
+@@ -431,13 +431,10 @@ config FEATURE_PREFER_APPLETS
- static void
--tryexec(IF_FEATURE_SH_STANDALONE(int applet_no,) char *cmd, char **argv, char **envp)
-+tryexec(char *cmd, char **argv, char **envp)
- {
--#if ENABLE_FEATURE_SH_STANDALONE
-- if (applet_no >= 0) {
-- if (APPLET_IS_NOEXEC(applet_no)) {
-- clearenv();
-- while (*envp)
-- putenv(*envp++);
-- run_applet_no_and_exit(applet_no, argv);
-- }
-- /* re-exec ourselves with the new arguments */
-- execve(bb_busybox_exec_path, argv, envp);
-- /* If they called chroot or otherwise made the binary no longer
-- * executable, fall through */
-- }
--#endif
+ config BUSYBOX_EXEC_PATH
+ string "Path to BusyBox executable"
+- default "/proc/self/exe"
++ default "/bin/busybox"
+ help
+ When Busybox applets need to run other busybox applets, BusyBox
+- sometimes needs to exec() itself. When the /proc filesystem is
+- mounted, /proc/self/exe always points to the currently running
+- executable. If you haven't got /proc, set this to wherever you
+- want to run BusyBox from.
++ sometimes needs to exec() itself.
- repeat:
- #ifdef SYSV
-@@ -7465,24 +7451,21 @@ shellexec(char **argv, const char *path,
- int e;
- char **envp;
- int exerrno;
--#if ENABLE_FEATURE_SH_STANDALONE
-- int applet_no = -1;
--#endif
+ # These are auto-selected by other options
- clearredir(/*drop:*/ 1);
- envp = listvars(VEXPORT, VUNSET, /*end:*/ NULL);
-- if (strchr(argv[0], '/') != NULL
--#if ENABLE_FEATURE_SH_STANDALONE
-- || (applet_no = find_applet_by_name(argv[0])) >= 0
--#endif
-- ) {
-- tryexec(IF_FEATURE_SH_STANDALONE(applet_no,) argv[0], argv, envp);
-+ if (strchr(argv[0], '/') != NULL) {
-+ tryexec(argv[0], argv, envp);
- e = errno;
- } else {
-+#if ENABLE_FEATURE_SH_STANDALONE
-+ bb_execv_applet(argv[0], argv, envp);
-+#endif
-+
- e = ENOENT;
- while ((cmdname = path_advance(&path, argv[0])) != NULL) {
- if (--idx < 0 && pathopt == NULL) {
-- tryexec(IF_FEATURE_SH_STANDALONE(-1,) cmdname, argv, envp);
-+ tryexec(cmdname, argv, envp);
- if (errno != ENOENT && errno != ENOTDIR)
- e = errno;
- }
+--- a/coreutils/chroot.c
++++ b/coreutils/chroot.c
+@@ -41,5 +41,7 @@ int chroot_main(int argc UNUSED_PARAM, c
+ /*argv[2] = NULL; - already is */
+ }
+
+- BB_EXECVP_or_die(argv);
++ execvp(argv[0], argv);
++ xfunc_error_retval = (errno == ENOENT) ? 127 : 126;
++ bb_perror_msg_and_die("can't execute '%s'", argv[0]);
+ }