From f644caad88237bb645bd7c61ec1c28582978f435 Mon Sep 17 00:00:00 2001 From: Kirk McKusick Date: Sat, 15 Aug 2020 21:40:36 +0000 Subject: [PATCH] Use the sbput() function to write alternate superblocks so that they get a checkhash. PR: 246983 Sponsored by: Netflix --- sbin/fsck_ffs/main.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c index 6284ce1e513..f5d53a14e0f 100644 --- a/sbin/fsck_ffs/main.c +++ b/sbin/fsck_ffs/main.c @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -604,10 +605,8 @@ checkfilesys(char *filesys) /* * Write out the duplicate super blocks */ - for (cylno = 0; cylno < sblock.fs_ncg; cylno++) - blwrite(fswritefd, (char *)&sblock, - fsbtodb(&sblock, cgsblock(&sblock, cylno)), - SBLOCKSIZE); + if (sbput(fswritefd, &sblock, sblock.fs_ncg) == 0) + fsmodified = 1; } if (rerun) resolved = 0;