aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-02-02 18:50:50 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-02-02 18:50:50 +0000
commit6e602c49316bf75376467c1aeb194741e85421d4 (patch)
tree00bee3c815d822b3a3706331504458c3c3aade04
parent80667e30fbd3feb95a0af4bca0f512694a438bde (diff)
downloadbusybox-w32-6e602c49316bf75376467c1aeb194741e85421d4.tar.gz
busybox-w32-6e602c49316bf75376467c1aeb194741e85421d4.tar.bz2
busybox-w32-6e602c49316bf75376467c1aeb194741e85421d4.zip
msh: also handle EOF/read errors correctly
-rw-r--r--shell/msh.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/shell/msh.c b/shell/msh.c
index 9a1be36d9..531ae779a 100644
--- a/shell/msh.c
+++ b/shell/msh.c
@@ -4836,11 +4836,11 @@ static int filechar(struct ioarg *ap)
4836 static int position = 0, size = 0; 4836 static int position = 0, size = 0;
4837 4837
4838 while (size == 0 || position >= size) { 4838 while (size == 0 || position >= size) {
4839 /* Repeat if Ctrl-C is pressed. TODO: exit on -1 (error/EOF)? */ 4839 size = read_line_input(current_prompt, filechar_cmdbuf, BUFSIZ, line_input_state);
4840 while (read_line_input(current_prompt, filechar_cmdbuf, BUFSIZ, line_input_state) == 0) 4840 if (size < 0) /* Error/EOF */
4841 continue; 4841 exit(0);
4842 size = strlen(filechar_cmdbuf);
4843 position = 0; 4842 position = 0;
4843 /* if Ctrl-C, size == 0 and loop will repeat */
4844 } 4844 }
4845 c = filechar_cmdbuf[position]; 4845 c = filechar_cmdbuf[position];
4846 position++; 4846 position++;