aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2025-05-08 15:49:53 +0000
committerMark Johnston <markj@FreeBSD.org>2025-05-08 15:49:53 +0000
commit764ccf410c3c5453c4656113d75cd81fcf01828d (patch)
tree47d33374714f1e354c5a6f3cb5f88d9884791805
parentd30a84ab442e13ba0ed9ac3b01743e49f94dcb41 (diff)
-rw-r--r--usr.sbin/makefs/ffs/mkfs.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/usr.sbin/makefs/ffs/mkfs.c b/usr.sbin/makefs/ffs/mkfs.c
index b2f752102a69..81e3da5725c8 100644
--- a/usr.sbin/makefs/ffs/mkfs.c
+++ b/usr.sbin/makefs/ffs/mkfs.c
@@ -579,13 +579,21 @@ ffs_write_superblock(struct fs *fs, const fsinfo_t *fsopts)
{
int size, blks, i, saveflag;
uint32_t cylno;
- void *space;
+ void *info, *space;
char *wrbuf;
saveflag = fs->fs_flags & FS_INTERNAL;
fs->fs_flags &= ~FS_INTERNAL;
- memcpy(writebuf, &sblock, sbsize);
+ /*
+ * Write out the superblock. Blank out the summary info field, as it's
+ * a random pointer that would make the resulting image unreproducible.
+ */
+ info = fs->fs_si;
+ fs->fs_si = NULL;
+ memcpy(writebuf, fs, sbsize);
+ fs->fs_si = info;
+
if (fsopts->needswap)
ffs_sb_swap(fs, (struct fs*)writebuf);
ffs_wtfs(fs->fs_sblockloc / sectorsize, sbsize, writebuf, fsopts);