diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c index 6d75decee4d9..0449288ba2f2 100644 --- a/sbin/newfs/mkfs.c +++ b/sbin/newfs/mkfs.c @@ -1,4 +1,4 @@ -/* $NetBSD: mkfs.c,v 1.110 2011/08/25 16:17:58 joerg Exp $ */ +/* $NetBSD: mkfs.c,v 1.111 2012/02/07 14:14:45 tsutsui Exp $ */ /* * Copyright (c) 1980, 1989, 1993 @@ -73,7 +73,7 @@ #if 0 static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95"; #else -__RCSID("$NetBSD: mkfs.c,v 1.110 2011/08/25 16:17:58 joerg Exp $"); +__RCSID("$NetBSD: mkfs.c,v 1.111 2012/02/07 14:14:45 tsutsui Exp $"); #endif #endif /* not lint */ @@ -152,6 +152,8 @@ union { ((sblock.fs_magic == FS_UFS1_MAGIC) ? \ (dp)->dp1.di_##field : (dp)->dp2.di_##field) +#define EXT2FS_SBOFF 1024 /* XXX: SBOFF in */ + char *iobuf; int iobufsize; /* size to end of 2nd inode block */ int iobuf_memsize; /* Actual buffer size */ @@ -615,6 +617,12 @@ mkfs(const char *fsys, int fi, int fo, for (sz = SBLOCKSIZE; sz <= 0x10000; sz <<= 1) zap_old_sblock(roundup(sblkoff, sz)); } + /* + * Also zap possible Ext2fs magic leftover to prevent + * kernel vfs_mountroot() and bootloaders from mis-recognizing + * this file system as Ext2fs. + */ + zap_old_sblock(EXT2FS_SBOFF); if (isappleufs) { struct appleufslabel appleufs;