diff options
author | Denis Vlasenko | 2008-11-29 06:43:05 +0000 |
---|---|---|
committer | Denis Vlasenko | 2008-11-29 06:43:05 +0000 |
commit | 9343da45d3f226cc8b45879ac8dbacac2911cdd8 (patch) | |
tree | 9e76d089f819e99fc7e57f3fb771af834cdc7c5a | |
parent | 84641942e5366b2e09367ba4f4376c99f15ecc8e (diff) | |
download | busybox-9343da45d3f226cc8b45879ac8dbacac2911cdd8.zip busybox-9343da45d3f226cc8b45879ac8dbacac2911cdd8.tar.gz |
apply post-1.12.2 fixes, bump version to 1.12.31_12_3
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | libbb/getopt32.c | 13 | ||||
-rw-r--r-- | libbb/lineedit.c | 2 |
3 files changed, 16 insertions, 1 deletions
@@ -1,6 +1,6 @@ VERSION = 1 PATCHLEVEL = 12 -SUBLEVEL = 2 +SUBLEVEL = 3 EXTRAVERSION = NAME = Unnamed diff --git a/libbb/getopt32.c b/libbb/getopt32.c index ee85181..f33ead1 100644 --- a/libbb/getopt32.c +++ b/libbb/getopt32.c @@ -515,6 +515,19 @@ getopt32(char **argv, const char *applet_opts, ...) } } + /* In case getopt32 was already called: + * reset the libc getopt() function, which keeps internal state. + * run_nofork_applet_prime() does this, but we might end up here + * also via gunzip_main() -> gzip_main(). Play safe. + */ +#ifdef __GLIBC__ + optind = 0; +#else /* BSD style */ + optind = 1; + /* optreset = 1; */ +#endif + /* optarg = NULL; opterr = 0; optopt = 0; - do we need this?? */ + pargv = NULL; /* Note: just "getopt() <= 0" will not work well for diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 1f21866..2388b37 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c @@ -1415,8 +1415,10 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li if ((state->flags & SAVE_HISTORY) && state->hist_file) load_history(state->hist_file); #endif +#if MAX_HISTORY > 0 if (state->flags & DO_HISTORY) state->cur_history = state->cnt_history; +#endif /* prepare before init handlers */ cmdedit_y = 0; /* quasireal y, not true if line > xt*yt */ |