]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_scrub: don't close stdout when closing the progress bar
authorDarrick J. Wong <djwong@kernel.org>
Mon, 29 Jul 2024 23:23:13 +0000 (16:23 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 30 Jul 2024 00:01:09 +0000 (17:01 -0700)
When we're tearing down the progress bar file stream, check that it's
not an alias of stdout before closing it.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
scrub/xfs_scrub.c

index edf58d07bde2e99e2fd998acff1cc98137606693..adf9d13e5090825ae067d6c0d4d6e098a4c75f70 100644 (file)
@@ -878,7 +878,7 @@ out:
        if (ctx.runtime_errors)
                ret |= SCRUB_RET_OPERROR;
        phase_end(&all_pi, 0);
-       if (progress_fp)
+       if (progress_fp && fileno(progress_fp) != 1)
                fclose(progress_fp);
 out_unicrash:
        unicrash_unload();