aboutsummaryrefslogtreecommitdiff
path: root/sbin/newfs/mkfs.c
diff options
context:
space:
mode:
authorColin Percival <cperciva@FreeBSD.org>2011-04-26 02:06:31 +0000
committerColin Percival <cperciva@FreeBSD.org>2011-04-26 02:06:31 +0000
commitc2805605f73ceac688828f7a52c77c4c1b6d8345 (patch)
tree719c084adac61ea799d8159dbf93d28c27290cd4 /sbin/newfs/mkfs.c
parent6bb544780b1d08d0bcac6703f199c145aa01f527 (diff)
downloadsrc-c2805605f73ceac688828f7a52c77c4c1b6d8345.tar.gz
src-c2805605f73ceac688828f7a52c77c4c1b6d8345.zip
Notes
Diffstat (limited to 'sbin/newfs/mkfs.c')
-rw-r--r--sbin/newfs/mkfs.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c
index f98a51a7c313..0503ebf0923d 100644
--- a/sbin/newfs/mkfs.c
+++ b/sbin/newfs/mkfs.c
@@ -516,9 +516,12 @@ restart:
fsdummy.fs_magic = 0;
bwrite(&disk, part_ofs + SBLOCK_UFS1 / disk.d_bsize,
chdummy, SBLOCKSIZE);
- for (cg = 0; cg < fsdummy.fs_ncg; cg++)
+ for (cg = 0; cg < fsdummy.fs_ncg; cg++) {
+ if (fsbtodb(&fsdummy, cgsblock(&fsdummy, cg)) > fssize)
+ break;
bwrite(&disk, part_ofs + fsbtodb(&fsdummy,
cgsblock(&fsdummy, cg)), chdummy, SBLOCKSIZE);
+ }
}
}
if (!Nflag)