summaryrefslogtreecommitdiff
path: root/shell/hush.c
diff options
context:
space:
mode:
authorDenis Vlasenko2008-02-20 22:23:24 +0000
committerDenis Vlasenko2008-02-20 22:23:24 +0000
commite376d454bb70ed41bbc3eb0358d37fa30c94358d (patch)
treeeb53c600dcde841a7617a19f819ae3e9cfe7fd84 /shell/hush.c
parentae86a338b89c1339588226cb2298e1785aaa7b90 (diff)
downloadbusybox-e376d454bb70ed41bbc3eb0358d37fa30c94358d.zip
busybox-e376d454bb70ed41bbc3eb0358d37fa30c94358d.tar.gz
libbb: introduce and use nonblock_safe_read(). Yay!
Our shells are immune from this nasty O_NONBLOCK now! function old new delta nonblock_safe_read - 78 +78 file_get 276 295 +19 generateMTFValues 428 435 +7 read_line_input 1776 1772 -4 preadbuffer 543 450 -93 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/2 up/down: 104/-97) Total: 7 bytes text data bss dec hex filename 615190 715 23924 639829 9c355 busybox_old 615168 715 23924 639807 9c33f busybox_unstripped
Diffstat (limited to 'shell/hush.c')
-rw-r--r--shell/hush.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/shell/hush.c b/shell/hush.c
index 4d48431..820fd88 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -1273,10 +1273,10 @@ static void get_user_input(struct in_str *i)
prompt_str = setup_prompt_string(i->promptmode);
#if ENABLE_FEATURE_EDITING
/* Enable command line editing only while a command line
- * is actually being read; otherwise, we'll end up bequeathing
- * atexit() handlers and other unwanted stuff to our
- * child processes (rob@sysgo.de) */
- r = read_line_input(prompt_str, user_input_buf, BUFSIZ-1, line_input_state);
+ * is actually being read */
+ do {
+ r = read_line_input(prompt_str, user_input_buf, BUFSIZ-1, line_input_state);
+ } while (r == 0); /* repeat if Ctrl-C */
i->eof_flag = (r < 0);
if (i->eof_flag) { /* EOF/error detected */
user_input_buf[0] = EOF; /* yes, it will be truncated, it's ok */