From 9137341851f3ab89f5c6a54a6baff68f0f4a5e17 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Mon, 21 Apr 2008 22:04:21 +0000 Subject: [PATCH] getopt32: fix recently broken opt_complementary "--" --- libbb/getopt32.c | 5 +++-- 1 file 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)