projects
/
oweals
/
busybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
80667e3
)
msh: also handle EOF/read errors correctly
author
Denis Vlasenko
<vda.linux@googlemail.com>
Sat, 2 Feb 2008 18:50:50 +0000
(18:50 -0000)
committer
Denis Vlasenko
<vda.linux@googlemail.com>
Sat, 2 Feb 2008 18:50:50 +0000
(18:50 -0000)
shell/msh.c
patch
|
blob
|
history
diff --git
a/shell/msh.c
b/shell/msh.c
index 9a1be36d99d0f04feb16b42e4a238eab4dbfcf90..531ae779a77578d90cdd763056f1fc64313fd233 100644
(file)
--- a/
shell/msh.c
+++ b/
shell/msh.c
@@
-4836,11
+4836,11
@@
static int filechar(struct ioarg *ap)
static int position = 0, size = 0;
while (size == 0 || position >= size) {
static int position = 0, size = 0;
while (size == 0 || position >= size) {
- /* Repeat if Ctrl-C is pressed. TODO: exit on -1 (error/EOF)? */
- while (read_line_input(current_prompt, filechar_cmdbuf, BUFSIZ, line_input_state) == 0)
- continue;
- size = strlen(filechar_cmdbuf);
+ size = read_line_input(current_prompt, filechar_cmdbuf, BUFSIZ, line_input_state);
+ if (size < 0) /* Error/EOF */
+ exit(0);
position = 0;
position = 0;
+ /* if Ctrl-C, size == 0 and loop will repeat */
}
c = filechar_cmdbuf[position];
position++;
}
c = filechar_cmdbuf[position];
position++;