]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib/pager: Flush outputs in pager_close
authorTobias Stoeckmann <tobias@stoeckmann.org>
Wed, 4 Feb 2026 19:36:48 +0000 (20:36 +0100)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Wed, 4 Feb 2026 19:41:57 +0000 (20:41 +0100)
Flush all outputs before waiting for child. This allows even outputs
which do not end in a newline to be shown by pager.

More importantly, it avoids output to be printed into original file
descriptors which were meant for pager.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
lib/pager.c

index bf626607f474d5bd5cffeb6d22004b1d3ab0e831..11d56c1b88339f65cce6a0ee3bfc7a843ff415a5 100644 (file)
@@ -266,6 +266,8 @@ void pager_close(void)
        sigaction(SIGQUIT, &sa, NULL);
        sigaction(SIGPIPE, &sa, NULL);
 
+       fflush(NULL);
+
        wait_for_pager();
 
        if (caught_signal)