diff options
author | Denis Vlasenko | 2008-04-23 07:22:31 +0000 |
---|---|---|
committer | Denis Vlasenko | 2008-04-23 07:22:31 +0000 |
commit | 765c1c3c31493787b9cb53cc80574734e42a8844 (patch) | |
tree | e60dcd43cd43e6a42196f3df14ed475771aece41 /libbb/getopt32.c | |
parent | 71e3ab327a155b513f612e328fc43e6b334fccc2 (diff) | |
download | busybox-765c1c3c31493787b9cb53cc80574734e42a8844.zip busybox-765c1c3c31493787b9cb53cc80574734e42a8844.tar.gz |
getopt32: fix "tar x" case; fix memory leak
Diffstat (limited to 'libbb/getopt32.c')
-rw-r--r-- | libbb/getopt32.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/libbb/getopt32.c b/libbb/getopt32.c index 913a009..4b5a7d2 100644 --- a/libbb/getopt32.c +++ b/libbb/getopt32.c @@ -494,7 +494,7 @@ getopt32(char **argv, const char *applet_opts, ...) va_end(p); if (spec_flgs & FIRST_ARGV_IS_OPT) { - if (argv[1] && argv[1][0] != '-' && argv[1][1] != '\0') { + if (argv[1] && argv[1][0] != '-' && argv[1][0] != '\0') { #if DONT_USE_PRINTF char *pp = alloca(strlen(argv[1]) + 2); *pp = '-'; @@ -502,8 +502,7 @@ getopt32(char **argv, const char *applet_opts, ...) argv[1] = pp; #else argv[1] = xasprintf("-%s", argv[1]); - if (ENABLE_FEATURE_CLEAN_UP) - spec_flgs |= FREE_FIRST_ARGV_IS_OPT; + spec_flgs |= FREE_FIRST_ARGV_IS_OPT; #endif } } @@ -586,10 +585,9 @@ getopt32(char **argv, const char *applet_opts, ...) } } -#if ENABLE_FEATURE_CLEAN_UP if (spec_flgs & FREE_FIRST_ARGV_IS_OPT) free(argv[1]); -#endif + /* check depending requires for given options */ for (on_off = complementary; on_off->opt_char; on_off++) { if (on_off->requires && (flags & on_off->switch_on) && |