]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_scrub: flush stdout after printing to it
authorDarrick J. Wong <djwong@kernel.org>
Fri, 12 Jan 2024 02:07:04 +0000 (18:07 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Fri, 12 Jan 2024 02:08:46 +0000 (18:08 -0800)
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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
scrub/xfs_scrub.c

index a1b675443915933664b41af703b31072b329b3a3..752180d646ba9eccd470bfb09590ac2237042b2c 100644 (file)
@@ -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, "");