diff options
author | Denys Vlasenko | 2010-09-07 18:40:53 +0200 |
---|---|---|
committer | Denys Vlasenko | 2010-09-07 18:40:53 +0200 |
commit | d55f599440c65c0808c6d14b339f6175995fcf7c (patch) | |
tree | 8c5ad90eb84340874b216b6cc97d5a09e349bd57 | |
parent | 8b2f13d84def87b4ebd0901bf0c3157bc1f6dee3 (diff) | |
download | busybox-d55f599440c65c0808c6d14b339f6175995fcf7c.zip busybox-d55f599440c65c0808c6d14b339f6175995fcf7c.tar.gz |
lineedit: do not hang on error, but return error indicator.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
-rw-r--r-- | libbb/lineedit.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index d2b808a..066b569 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c @@ -2169,7 +2169,7 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li ic = lineedit_read_key(read_key_buffer); if (errno) /* error */ - goto prepare_to_die; + goto return_error_indicator; if (ic == ic_raw) { /* "cc", "dd" */ input_backward(cursor); goto clear_to_eol; @@ -2233,7 +2233,7 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li //FIXME: unicode case? ic = lineedit_read_key(read_key_buffer); if (errno) /* error */ - goto prepare_to_die; + goto return_error_indicator; if (ic < ' ' || ic > 255) { beep(); } else { @@ -2305,9 +2305,9 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li * or exit if len=0 and no chars to delete */ if (command_len == 0) { errno = 0; -#if ENABLE_FEATURE_EDITING_VI - prepare_to_die: -#endif + + case -1: /* error (e.g. EIO when tty is destroyed) */ + IF_FEATURE_EDITING_VI(return_error_indicator:) break_out = command_len = -1; break; } @@ -2317,7 +2317,7 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li // /* Control-V -- force insert of next char */ // if (c == CTRL('V')) { // if (safe_read(STDIN_FILENO, &c, 1) < 1) -// goto prepare_to_die; +// goto return_error_indicator; // if (c == 0) { // beep(); // break; |