summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Kraai2001-08-27 15:02:32 +0000
committerMatt Kraai2001-08-27 15:02:32 +0000
commit449377aa6a8cb6b75d3b6aff6af7aade3174b2f3 (patch)
tree44e814ac04f10384b2f87986a2c2faa6b3f8e9a6
parent80f6d55836963f4e85c297f2901161d0ff69b4cb (diff)
downloadbusybox-449377aa6a8cb6b75d3b6aff6af7aade3174b2f3.zip
busybox-449377aa6a8cb6b75d3b6aff6af7aade3174b2f3.tar.gz
Fix invocation of `-/bin/sh' (bug #1209).
-rw-r--r--Changelog1
-rw-r--r--applets/busybox.c12
-rw-r--r--busybox.c12
3 files changed, 13 insertions, 12 deletions
diff --git a/Changelog b/Changelog
index 5e0f5fd..bd149b0 100644
--- a/Changelog
+++ b/Changelog
@@ -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 7a220f7..33efb5d 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' */
diff --git a/busybox.c b/busybox.c
index 7a220f7..33efb5d 100644
--- a/busybox.c
+++ b/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' */