Browse Source

more: avoid infinite loop on --squeeze

The command 'echo | more -s' ends in infinite loop if exit-on-EOF is
disabled (default now). We need to call more_key_command() to ask for
user's reaction.

Fixes: https://github.com/util-linux/util-linux/issues/1669
Signed-off-by: Karel Zak <kzak@redhat.com>
pull/1675/head
Karel Zak 2 months ago
parent
commit
5c8f5f171d
  1. 2
      text-utils/more.c

2
text-utils/more.c

@ -1828,7 +1828,7 @@ static void screen(struct more_control *ctl, int num_lines)
putp(ctl->clear_rest);
return;
}
if (ctl->squeeze_spaces && length == 0 && prev_len == 0)
if (ctl->squeeze_spaces && length == 0 && prev_len == 0 && !ctl->is_eof)
continue;
prev_len = length;
if (ctl->bad_stdout

Loading…
Cancel
Save