diff mbox series

[1/7] xfs_scrub: flush stdout after printing to it

Message ID 170404998660.1797322.4141893748731169587.stgit@frogsfrogsfrogs (mailing list archive)
State New
Headers show
Series [1/7] xfs_scrub: flush stdout after printing to it | expand

Commit Message

Darrick J. Wong Dec. 31, 2023, 10:36 p.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

Make sure we flush stdout after printf'ing to it, especially before we
start any operation that could take a while to complete.  Most of scrub
already does this, but we missed a couple of spots.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 scrub/xfs_scrub.c |    2 ++
 1 file changed, 2 insertions(+)

Comments

Christoph Hellwig Jan. 5, 2024, 4:55 a.m. UTC | #1
On Sun, Dec 31, 2023 at 02:36:41PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Make sure we flush stdout after printf'ing to it, especially before we
> start any operation that could take a while to complete.  Most of scrub
> already does this, but we missed a couple of spots.

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/scrub/xfs_scrub.c b/scrub/xfs_scrub.c
index a1b67544391..752180d646b 100644
--- a/scrub/xfs_scrub.c
+++ b/scrub/xfs_scrub.c
@@ -535,6 +535,7 @@  _("%s: repairs made: %llu.\n"),
 		fprintf(stdout,
 _("%s: optimizations made: %llu.\n"),
 				ctx->mntpoint, ctx->preens);
+	fflush(stdout);
 }
 
 static void
@@ -620,6 +621,7 @@  main(
 	int			error;
 
 	fprintf(stdout, "EXPERIMENTAL xfs_scrub program in use! Use at your own risk!\n");
+	fflush(stdout);
 
 	progname = basename(argv[0]);
 	setlocale(LC_ALL, "");