From: Karel Zak Date: Mon, 2 May 2022 10:57:13 +0000 (+0200) Subject: more: avoid infinite loop on --squeeze X-Git-Tag: v2.38.1~56 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b269ca07383ae93589e36544da414931cdb6e3d7;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