summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-apps/busybox/files/1.00/standalone.patch')
-rw-r--r--sys-apps/busybox/files/1.00/standalone.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/sys-apps/busybox/files/1.00/standalone.patch b/sys-apps/busybox/files/1.00/standalone.patch
new file mode 100644
index 000000000000..25acc4faabef
--- /dev/null
+++ b/sys-apps/busybox/files/1.00/standalone.patch
@@ -0,0 +1,37 @@
+--- trunk/busybox/shell/ash.c 2005/02/10 00:44:31 9838
++++ trunk/busybox/shell/ash.c 2005/05/07 08:27:34 10264
+@@ -3722,27 +3722,13 @@
+ {
+ int repeated = 0;
+ #ifdef CONFIG_FEATURE_SH_STANDALONE_SHELL
+- int flg_bb = 0;
+- char *name = cmd;
+-
+- if(strchr(name, '/') == NULL && find_applet_by_name(name) != NULL) {
+- flg_bb = 1;
+- }
+- if(flg_bb) {
+- char **ap;
+- char **new;
+-
+- *argv = name;
+- if(strcmp(name, "busybox")) {
+- for (ap = argv; *ap; ap++);
+- ap = new = xmalloc((ap - argv + 2) * sizeof(char *));
+- *ap++ = cmd = "/bin/busybox";
+- while ((*ap++ = *argv++));
+- argv = new;
+- repeated++;
+- } else {
+- cmd = "/bin/busybox";
+- }
++ if(find_applet_by_name(cmd) != NULL) {
++ /* re-exec ourselves with the new arguments */
++ execve("/proc/self/exe",argv,envp);
++ /* If proc isn't mounted, try hardcoded path to busybox binary*/
++ execve("/bin/busybox",argv,envp);
++ /* If they called chroot or otherwise made the binary no longer
++ * executable, fall through */
+ }
+ #endif
+