aboutsummaryrefslogtreecommitdiff
path: root/libbb/getopt32.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-08-20 00:15:42 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-08-20 00:15:42 +0000
commit4301616b27afa808eeb8ea619dd7f3f9fa540462 (patch)
tree9fb78f2585aa069010e6d7019f471518bc866f39 /libbb/getopt32.c
parent1c45a505eb109af13e5399c2b016acec4ad10421 (diff)
downloadbusybox-4301616b27afa808eeb8ea619dd7f3f9fa540462.tar.gz
libbb: getopt32() should not ever touch argv[0] (even read)
Diffstat (limited to 'libbb/getopt32.c')
-rw-r--r--libbb/getopt32.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libbb/getopt32.c b/libbb/getopt32.c
index 611333c66..54dc7857d 100644
--- a/libbb/getopt32.c
+++ b/libbb/getopt32.c
@@ -338,7 +338,8 @@ getopt32(char **argv, const char *applet_opts, ...)
int spec_flgs = 0;
- argc = 0;
+ /* skip 0: some applets cheat: they do not actually HAVE argv[0] */
+ argc = 1;
while (argv[argc])
argc++;