mirror of
https://github.com/sheumann/hush.git
synced 2024-11-05 21:04:56 +00:00
msh: also handle EOF/read errors correctly
This commit is contained in:
parent
80667e30fb
commit
6e602c4931
@ -4836,11 +4836,11 @@ static int filechar(struct ioarg *ap)
|
|||||||
static int position = 0, size = 0;
|
static int position = 0, size = 0;
|
||||||
|
|
||||||
while (size == 0 || position >= size) {
|
while (size == 0 || position >= size) {
|
||||||
/* Repeat if Ctrl-C is pressed. TODO: exit on -1 (error/EOF)? */
|
size = read_line_input(current_prompt, filechar_cmdbuf, BUFSIZ, line_input_state);
|
||||||
while (read_line_input(current_prompt, filechar_cmdbuf, BUFSIZ, line_input_state) == 0)
|
if (size < 0) /* Error/EOF */
|
||||||
continue;
|
exit(0);
|
||||||
size = strlen(filechar_cmdbuf);
|
|
||||||
position = 0;
|
position = 0;
|
||||||
|
/* if Ctrl-C, size == 0 and loop will repeat */
|
||||||
}
|
}
|
||||||
c = filechar_cmdbuf[position];
|
c = filechar_cmdbuf[position];
|
||||||
position++;
|
position++;
|
||||||
|
Loading…
Reference in New Issue
Block a user