diff options
author | Glenn L McGrath | 2003-10-03 13:21:10 +0000 |
---|---|---|
committer | Glenn L McGrath | 2003-10-03 13:21:10 +0000 |
commit | f86bd9f2cdfa3e9cfb54724e98f71a7657ff6019 (patch) | |
tree | a0ee11950d11c9acee9c9fe7d82c4d3a5dc000fb /applets | |
parent | 07cf92676ae70daab83d5aa248f24c003c07001d (diff) | |
download | busybox-f86bd9f2cdfa3e9cfb54724e98f71a7657ff6019.zip busybox-f86bd9f2cdfa3e9cfb54724e98f71a7657ff6019.tar.gz |
Reverse my previous changes and make a note about why its dont this way
Diffstat (limited to 'applets')
-rw-r--r-- | applets/busybox.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/applets/busybox.c b/applets/busybox.c index 13b9f6f..9d41b52 100644 --- a/applets/busybox.c +++ b/applets/busybox.c @@ -162,7 +162,18 @@ int busybox_main(int argc, char **argv) been_there_done_that = 1; /* Move the command line down a notch */ - return (main(argc, argv+1)); + /* Preserve pointers so setproctitle() works consistently */ + len = argv[argc] + strlen(argv[argc]) - argv[1]; + memmove(argv[0], argv[1], len); + memset(argv[0] + len, 0, argv[1] - argv[0]); + + /* Fix up the argv pointers */ + len = argv[1] - argv[0]; + memmove(argv, argv + 1, sizeof(char *) * (argc + 1)); + for (i = 0; i < argc; i++) + argv[i] -= len; + + return (main(argc, argv)); } /* |