apply post-1.12.2 fixes, bump version to 1.12.3 1_12_3
authorDenis Vlasenko <vda.linux@googlemail.com>
Sat, 29 Nov 2008 06:43:05 +0000 (06:43 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Sat, 29 Nov 2008 06:43:05 +0000 (06:43 -0000)
Makefile
libbb/getopt32.c
libbb/lineedit.c

index c25cf5d11570ef91289f3ec01ae64f6b92c2c29b..1bfb270829851a513bed5609eac8370639136d31 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 1
 PATCHLEVEL = 12
-SUBLEVEL = 2
+SUBLEVEL = 3
 EXTRAVERSION =
 NAME = Unnamed
 
index ee85181cd2d670cd16e5a938c468ed0a4323939f..f33ead1c6e170794b678a1e255f6226cf38af53f 100644 (file)
@@ -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
index 1f21866ca65b28a34603d80a532febae8042332a..2388b3721f6ac643151fe5649436508dd45beac7 100644 (file)
@@ -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 */