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
This commit is contained in:
@ -1408,9 +1408,9 @@ int read_line_input(const char *prompt, char *command, int maxsize, line_input_t
|
||||
parse_and_put_prompt(prompt);
|
||||
|
||||
while (1) {
|
||||
fflush(stdout);
|
||||
fflush(NULL);
|
||||
|
||||
if (safe_read(STDIN_FILENO, &c, 1) < 1) {
|
||||
if (nonblock_safe_read(STDIN_FILENO, &c, 1) < 1) {
|
||||
/* if we can't read input then exit */
|
||||
goto prepare_to_die;
|
||||
}
|
||||
|
Reference in New Issue
Block a user