summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2007-03-18 21:44:02 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2007-03-18 21:44:02 +0000
commit979402fd6b0495f290995a80e8e49044529c90e7 (patch)
tree972c328994cdc7ca1c259686d7a5b14a843c4d4b
parent62c5e2306531d15984ec74f62b221ef0a2a15aaf (diff)
there's no way we're going to be able to handle illegal block or
fragment sizes, so just make those conditions fatal errors and tell the calling code to go look for alternate superblocks. ok millert@
-rw-r--r--sbin/fsck_ffs/setup.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c
index 875237a010f..0c4151d72f8 100644
--- a/sbin/fsck_ffs/setup.c
+++ b/sbin/fsck_ffs/setup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: setup.c,v 1.29 2007/02/16 08:34:29 otto Exp $ */
+/* $OpenBSD: setup.c,v 1.30 2007/03/18 21:44:01 otto Exp $ */
/* $NetBSD: setup.c,v 1.27 1996/09/27 22:45:19 christos Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)setup.c 8.5 (Berkeley) 11/23/94";
#else
-static const char rcsid[] = "$OpenBSD: setup.c,v 1.29 2007/02/16 08:34:29 otto Exp $";
+static const char rcsid[] = "$OpenBSD: setup.c,v 1.30 2007/03/18 21:44:01 otto Exp $";
#endif
#endif /* not lint */
@@ -482,12 +482,16 @@ readsb(int listerr)
}
if (!POWEROF2(sblock.fs_bsize) || sblock.fs_bsize < MINBSIZE ||
- sblock.fs_bsize > MAXBSIZE)
+ sblock.fs_bsize > MAXBSIZE) {
badsb(listerr, "ILLEGAL BLOCK SIZE");
+ return (0);
+ }
if (!POWEROF2(sblock.fs_fsize) || sblock.fs_fsize > sblock.fs_bsize ||
- sblock.fs_fsize < sblock.fs_bsize / MAXFRAG)
+ sblock.fs_fsize < sblock.fs_bsize / MAXFRAG) {
badsb(listerr, "ILLEGAL FRAGMENT SIZE");
+ return (0);
+ }
/*