From: Karel Zak Date: Mon, 2 May 2022 10:57:13 +0000 (+0200) Subject: more: avoid infinite loop on --squeeze X-Git-Tag: v2.39-rc1~680 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5c8f5f171d5621a2bc540c21cc62f308a43d4fc5;p=thirdparty%2Futil-linux.git 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 --- diff --git a/text-utils/more.c b/text-utils/more.c index a0d62bd5bf..e3e2a43364 100644 --- a/text-utils/more.c +++ b/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