aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2016-09-29 20:25:44 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2016-09-29 20:25:44 +0200
commit0448c55cc84294d330305066d8f0a16b56e04b8b (patch)
tree9264c74e05bf74f6072ca7a1f11d43e6b96978e0
parent7a24e8ffebf60d5d5343f7207bb84e5766c2f902 (diff)
downloadbusybox-w32-0448c55cc84294d330305066d8f0a16b56e04b8b.tar.gz
busybox-w32-0448c55cc84294d330305066d8f0a16b56e04b8b.tar.bz2
busybox-w32-0448c55cc84294d330305066d8f0a16b56e04b8b.zip
hush: G.user_input_buf[] is needed only if line editing is enabled
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/hush.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/shell/hush.c b/shell/hush.c
index 65d7d870b..d0b53339d 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -834,7 +834,9 @@ struct globals {
834 int debug_indent; 834 int debug_indent;
835#endif 835#endif
836 struct sigaction sa; 836 struct sigaction sa;
837 char user_input_buf[ENABLE_FEATURE_EDITING ? CONFIG_FEATURE_EDITING_MAX_LEN : 2]; 837#if ENABLE_FEATURE_EDITING
838 char user_input_buf[CONFIG_FEATURE_EDITING_MAX_LEN];
839#endif
838}; 840};
839#define G (*ptr_to_globals) 841#define G (*ptr_to_globals)
840/* Not #defining name to G.name - this quickly gets unwieldy 842/* Not #defining name to G.name - this quickly gets unwieldy
@@ -2174,7 +2176,10 @@ static int get_user_input(struct in_str *i)
2174 G.flag_SIGINT = 0; 2176 G.flag_SIGINT = 0;
2175 /* buglet: SIGINT will not make new prompt to appear _at once_, 2177 /* buglet: SIGINT will not make new prompt to appear _at once_,
2176 * only after <Enter>. (^C will work) */ 2178 * only after <Enter>. (^C will work) */
2177 r = read_line_input(G.line_input_state, prompt_str, G.user_input_buf, CONFIG_FEATURE_EDITING_MAX_LEN-1, /*timeout*/ -1); 2179 r = read_line_input(G.line_input_state, prompt_str,
2180 G.user_input_buf, CONFIG_FEATURE_EDITING_MAX_LEN-1,
2181 /*timeout*/ -1
2182 );
2178 /* catch *SIGINT* etc (^C is handled by read_line_input) */ 2183 /* catch *SIGINT* etc (^C is handled by read_line_input) */
2179 check_and_run_traps(); 2184 check_and_run_traps();
2180 } while (r == 0 || G.flag_SIGINT); /* repeat if ^C or SIGINT */ 2185 } while (r == 0 || G.flag_SIGINT); /* repeat if ^C or SIGINT */