diff options
-rw-r--r-- | Changelog | 1 | ||||
-rw-r--r-- | applets/busybox.c | 12 | ||||
-rw-r--r-- | busybox.c | 12 |
3 files changed, 13 insertions, 12 deletions
@@ -17,6 +17,7 @@ -- Optimized gzip.c, shrinking it be ~1.5k * Matt Kraai -- Fix sed s/[/]// handling (closes: #1208). + -- Fix `-/bin/sh' invocation (closes: #1209). -Erik Andersen, --not yet released-- diff --git a/applets/busybox.c b/applets/busybox.c index 7a220f7b0..33efb5d84 100644 --- a/applets/busybox.c +++ b/applets/busybox.c @@ -69,16 +69,16 @@ int main(int argc, char **argv) { const char *s; - for (s = applet_name = argv[0]; *s != '\0';) { + applet_name = argv[0]; + + if (applet_name[0] == '-') + applet_name++; + + for (s = applet_name; *s != '\0';) { if (*s++ == '/') applet_name = s; } - /* Add in a special case hack for a leading hyphen */ - if (**argv == '-' && *(*argv+1)!= '-') { - applet_name = (*argv+1); - } - #ifdef BB_LOCALE_SUPPORT #ifdef BB_INIT if(getpid()!=1) /* Do not set locale for `init' */ @@ -69,16 +69,16 @@ int main(int argc, char **argv) { const char *s; - for (s = applet_name = argv[0]; *s != '\0';) { + applet_name = argv[0]; + + if (applet_name[0] == '-') + applet_name++; + + for (s = applet_name; *s != '\0';) { if (*s++ == '/') applet_name = s; } - /* Add in a special case hack for a leading hyphen */ - if (**argv == '-' && *(*argv+1)!= '-') { - applet_name = (*argv+1); - } - #ifdef BB_LOCALE_SUPPORT #ifdef BB_INIT if(getpid()!=1) /* Do not set locale for `init' */ |