hush: G.user_input_buf[] is needed only if line editing is enabled
authorDenys Vlasenko <vda.linux@googlemail.com>
Thu, 29 Sep 2016 18:25:44 +0000 (20:25 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Thu, 29 Sep 2016 18:25:44 +0000 (20:25 +0200)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/hush.c

index 65d7d870b4b03234d5d02c8302ceca0277b07317..d0b53339d167c0019942b9829bba7676a19d0305 100644 (file)
@@ -834,7 +834,9 @@ struct globals {
        int debug_indent;
 #endif
        struct sigaction sa;
-       char user_input_buf[ENABLE_FEATURE_EDITING ? CONFIG_FEATURE_EDITING_MAX_LEN : 2];
+#if ENABLE_FEATURE_EDITING
+       char user_input_buf[CONFIG_FEATURE_EDITING_MAX_LEN];
+#endif
 };
 #define G (*ptr_to_globals)
 /* Not #defining name to G.name - this quickly gets unwieldy
@@ -2174,7 +2176,10 @@ static int get_user_input(struct in_str *i)
                G.flag_SIGINT = 0;
                /* buglet: SIGINT will not make new prompt to appear _at once_,
                 * only after <Enter>. (^C will work) */
-               r = read_line_input(G.line_input_state, prompt_str, G.user_input_buf, CONFIG_FEATURE_EDITING_MAX_LEN-1, /*timeout*/ -1);
+               r = read_line_input(G.line_input_state, prompt_str,
+                               G.user_input_buf, CONFIG_FEATURE_EDITING_MAX_LEN-1,
+                               /*timeout*/ -1
+               );
                /* catch *SIGINT* etc (^C is handled by read_line_input) */
                check_and_run_traps();
        } while (r == 0 || G.flag_SIGINT); /* repeat if ^C or SIGINT */