summaryrefslogtreecommitdiffstats
path: root/usr.sbin/makefs
diff options
context:
space:
mode:
authornatano <natano@openbsd.org>2016-10-22 10:03:52 +0000
committernatano <natano@openbsd.org>2016-10-22 10:03:52 +0000
commit6cf6c8be10ef4cd25e3522707735574fe6483e4a (patch)
tree3c3f7ce841fc665e495b3377385672809ff8f15e /usr.sbin/makefs
parentFactor out pr->ps_vmspace into a local variable for fill_kproc() (diff)
downloadwireguard-openbsd-6cf6c8be10ef4cd25e3522707735574fe6483e4a.tar.xz
wireguard-openbsd-6cf6c8be10ef4cd25e3522707735574fe6483e4a.zip
Avoid writing pointers to the disk (image).
Diffstat (limited to 'usr.sbin/makefs')
-rw-r--r--usr.sbin/makefs/ffs/mkfs.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.sbin/makefs/ffs/mkfs.c b/usr.sbin/makefs/ffs/mkfs.c
index 234fec118c8..8b0bb88a395 100644
--- a/usr.sbin/makefs/ffs/mkfs.c
+++ b/usr.sbin/makefs/ffs/mkfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mkfs.c,v 1.7 2016/10/21 09:43:50 natano Exp $ */
+/* $OpenBSD: mkfs.c,v 1.8 2016/10/22 10:03:52 natano Exp $ */
/* $NetBSD: mkfs.c,v 1.34 2016/06/24 19:24:11 christos Exp $ */
/*
@@ -529,10 +529,16 @@ void
ffs_write_superblock(struct fs *fs, const fsinfo_t *fsopts)
{
int cylno, size, blks, i;
+ struct fs *fsdup;
void *space;
char *wrbuf;
memcpy(writebuf, fs, SBLOCKSIZE);
+
+ fsdup = (struct fs *)writebuf;
+ fsdup->fs_csp = NULL;
+ fsdup->fs_maxcluster = NULL;
+
ffs_wtfs(fs->fs_sblockloc / sectorsize, SBLOCKSIZE, writebuf, fsopts);
/* Write out the duplicate super blocks */