aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--applets/busybox.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/applets/busybox.c b/applets/busybox.c
index 13b9f6fcb..9d41b52f7 100644
--- a/applets/busybox.c
+++ b/applets/busybox.c
@@ -162,7 +162,18 @@ int busybox_main(int argc, char **argv)
162 been_there_done_that = 1; 162 been_there_done_that = 1;
163 163
164 /* Move the command line down a notch */ 164 /* Move the command line down a notch */
165 return (main(argc, argv+1)); 165 /* Preserve pointers so setproctitle() works consistently */
166 len = argv[argc] + strlen(argv[argc]) - argv[1];
167 memmove(argv[0], argv[1], len);
168 memset(argv[0] + len, 0, argv[1] - argv[0]);
169
170 /* Fix up the argv pointers */
171 len = argv[1] - argv[0];
172 memmove(argv, argv + 1, sizeof(char *) * (argc + 1));
173 for (i = 0; i < argc; i++)
174 argv[i] -= len;
175
176 return (main(argc, argv));
166} 177}
167 178
168/* 179/*