aboutsummaryrefslogtreecommitdiff
path: root/libbb/getopt32.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-04-21 22:04:21 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-04-21 22:04:21 +0000
commit9137341851f3ab89f5c6a54a6baff68f0f4a5e17 (patch)
tree4fe6ff0882222938c452b09f127d00a43c5b0566 /libbb/getopt32.c
parent5a07a1d255da10214ddd3cb8dda75bfbfdf46e4c (diff)
downloadbusybox-9137341851f3ab89f5c6a54a6baff68f0f4a5e17.tar.gz
getopt32: fix recently broken opt_complementary "--"
Diffstat (limited to 'libbb/getopt32.c')
-rw-r--r--libbb/getopt32.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libbb/getopt32.c b/libbb/getopt32.c
index cd890323e..913a009b0 100644
--- a/libbb/getopt32.c
+++ b/libbb/getopt32.c
@@ -497,8 +497,9 @@ getopt32(char **argv, const char *applet_opts, ...)
if (argv[1] && argv[1][0] != '-' && argv[1][1] != '\0') {
#if DONT_USE_PRINTF
char *pp = alloca(strlen(argv[1]) + 2);
- *pp++ = '-';
- argv[1] = strcpy(pp, argv[1]);
+ *pp = '-';
+ strcpy(pp + 1, argv[1]);
+ argv[1] = pp;
#else
argv[1] = xasprintf("-%s", argv[1]);
if (ENABLE_FEATURE_CLEAN_UP)