[PATCH] ash: treat busybox as a builtin applet in standalone shell mode
Ron Yorston
rmy at pobox.com
Thu May 19 12:36:11 UTC 2016
"busybox" doesn't appear in the list of applet names. Pretend that
it does when in standalone shell mode. This allows the binary to
be called "sh" while still allowing the command "busybox" to be run
from the shell.
function old new delta
shellexec 241 287 +46
find_command 847 864 +17
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 63/0) Total: 63 bytes
Signed-off-by: Ron Yorston <rmy at pobox.com>
---
shell/ash.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/shell/ash.c b/shell/ash.c
index faa45a8..4bc9ba2 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -7463,6 +7463,11 @@ shellexec(char **argv, const char *path, int idx)
goto try_PATH;
}
e = errno;
+#if ENABLE_FEATURE_SH_STANDALONE
+ } else if (strcmp(argv[0], "busybox") == 0) {
+ tryexec(-1, bb_busybox_exec_path, argv, envp);
+ e = errno;
+#endif
} else {
try_PATH:
e = ENOENT;
@@ -12387,7 +12392,7 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path)
#if ENABLE_FEATURE_SH_STANDALONE
{
int applet_no = find_applet_by_name(name);
- if (applet_no >= 0) {
+ if (applet_no >= 0 || strcmp(name, "busybox") == 0) {
entry->cmdtype = CMDNORMAL;
entry->u.index = -2 - applet_no;
return;
--
2.5.5
More information about the busybox
mailing list