]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib/pager: Clear potential stdout/stderr errors
authorTobias Stoeckmann <tobias@stoeckmann.org>
Wed, 4 Feb 2026 19:42:59 +0000 (20:42 +0100)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Wed, 4 Feb 2026 19:42:59 +0000 (20:42 +0100)
Clear stdout/stderr errors which might have occurred in communication
with pager. Since output is flushed and file descriptors replaced, the
information is meaningless.

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

index 11d56c1b88339f65cce6a0ee3bfc7a843ff415a5..4fe61ffa21fdf06944647989919a2fbbd86f9650 100644 (file)
@@ -274,7 +274,9 @@ void pager_close(void)
                _exit(EXIT_FAILURE);
 
        /* restore original output */
+       clearerr(stdout);
        dup2(pager_process.org_out, STDOUT_FILENO);
+       clearerr(stderr);
        dup2(pager_process.org_err, STDERR_FILENO);
 
        close(pager_process.org_out);