From: Eric Andersen Date: Mon, 3 Sep 2001 19:21:07 +0000 (-0000) Subject: Backport fix from Matt, for when applet names contain a leading dash X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=9b2afe6dd66bcb975f037cb7b78ef0e6f9e87212;p=oweals%2Fbusybox.git Backport fix from Matt, for when applet names contain a leading dash and a full pathname. --- diff --git a/busybox/applets/busybox.c b/busybox/applets/busybox.c index 7a220f7b0..33efb5d84 100644 --- a/busybox/applets/busybox.c +++ b/busybox/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' */ diff --git a/busybox/busybox.c b/busybox/busybox.c index 7a220f7b0..33efb5d84 100644 --- a/busybox/busybox.c +++ b/busybox/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' */