summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2010-09-07 18:40:53 +0200
committerDenys Vlasenko <dvlasenk@redhat.com>2010-09-07 18:40:53 +0200
commitd55f599440c65c0808c6d14b339f6175995fcf7c (patch)
tree8c5ad90eb84340874b216b6cc97d5a09e349bd57
parent8b2f13d84def87b4ebd0901bf0c3157bc1f6dee3 (diff)
downloadbusybox-w32-d55f599440c65c0808c6d14b339f6175995fcf7c.tar.gz
busybox-w32-d55f599440c65c0808c6d14b339f6175995fcf7c.tar.bz2
busybox-w32-d55f599440c65c0808c6d14b339f6175995fcf7c.zip
lineedit: do not hang on error, but return error indicator.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
-rw-r--r--libbb/lineedit.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index d2b808adf..066b569f6 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
2169 2169
2170 ic = lineedit_read_key(read_key_buffer); 2170 ic = lineedit_read_key(read_key_buffer);
2171 if (errno) /* error */ 2171 if (errno) /* error */
2172 goto prepare_to_die; 2172 goto return_error_indicator;
2173 if (ic == ic_raw) { /* "cc", "dd" */ 2173 if (ic == ic_raw) { /* "cc", "dd" */
2174 input_backward(cursor); 2174 input_backward(cursor);
2175 goto clear_to_eol; 2175 goto clear_to_eol;
@@ -2233,7 +2233,7 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li
2233//FIXME: unicode case? 2233//FIXME: unicode case?
2234 ic = lineedit_read_key(read_key_buffer); 2234 ic = lineedit_read_key(read_key_buffer);
2235 if (errno) /* error */ 2235 if (errno) /* error */
2236 goto prepare_to_die; 2236 goto return_error_indicator;
2237 if (ic < ' ' || ic > 255) { 2237 if (ic < ' ' || ic > 255) {
2238 beep(); 2238 beep();
2239 } else { 2239 } else {
@@ -2305,9 +2305,9 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li
2305 * or exit if len=0 and no chars to delete */ 2305 * or exit if len=0 and no chars to delete */
2306 if (command_len == 0) { 2306 if (command_len == 0) {
2307 errno = 0; 2307 errno = 0;
2308#if ENABLE_FEATURE_EDITING_VI 2308
2309 prepare_to_die: 2309 case -1: /* error (e.g. EIO when tty is destroyed) */
2310#endif 2310 IF_FEATURE_EDITING_VI(return_error_indicator:)
2311 break_out = command_len = -1; 2311 break_out = command_len = -1;
2312 break; 2312 break;
2313 } 2313 }
@@ -2317,7 +2317,7 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li
2317// /* Control-V -- force insert of next char */ 2317// /* Control-V -- force insert of next char */
2318// if (c == CTRL('V')) { 2318// if (c == CTRL('V')) {
2319// if (safe_read(STDIN_FILENO, &c, 1) < 1) 2319// if (safe_read(STDIN_FILENO, &c, 1) < 1)
2320// goto prepare_to_die; 2320// goto return_error_indicator;
2321// if (c == 0) { 2321// if (c == 0) {
2322// beep(); 2322// beep();
2323// break; 2323// break;