← Commit list

6e602c493

Denis Vlasenko
Denis Vlasenko
2008-02-02
FAILED Duration: 13s

Subject

msh: also handle EOF/read errors correctly

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

shell/msh.c+4 -4
@@ -4836,11 +4836,11 @@ static int filechar(struct ioarg *ap)
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;
+ /* if Ctrl-C, size == 0 and loop will repeat */
}
c = filechar_cmdbuf[position];
position++;