summaryrefslogtreecommitdiffstats
path: root/sbin/newfs/newfs.c
diff options
context:
space:
mode:
authormckusick <mckusick@FreeBSD.org>2002-11-30 18:28:26 +0000
committermckusick <mckusick@FreeBSD.org>2002-11-30 18:28:26 +0000
commitb52fe76381f5a430ac048bbceed2ef12f7372fc9 (patch)
treec972d64e51343676c8cdf9bab266290bd41df6ba /sbin/newfs/newfs.c
parent7e6582e5c1372b582051a77dfcafc1c10c1489f5 (diff)
downloadFreeBSD-src-b52fe76381f5a430ac048bbceed2ef12f7372fc9.zip
FreeBSD-src-b52fe76381f5a430ac048bbceed2ef12f7372fc9.tar.gz
Add some more checks to newfs so that it will not build filesystems
that the kernel will refuse to mount. Specifically it now enforces the MAXBSIZE blocksize limit. This update also fixes a problem where newfs could segment fault if the selected fragment size was too large. PR: bin/30959 Submitted by: Ceri Davies <setantae@submonkey.net> Sponsored by: DARPA & NAI Labs.
Diffstat (limited to 'sbin/newfs/newfs.c')
-rw-r--r--sbin/newfs/newfs.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c
index 8b03e94..50034a2 100644
--- a/sbin/newfs/newfs.c
+++ b/sbin/newfs/newfs.c
@@ -187,7 +187,11 @@ main(int argc, char *argv[])
break;
case 'b':
if ((bsize = atoi(optarg)) < MINBSIZE)
- errx(1, "%s: bad block size", optarg);
+ errx(1, "%s: block size too small, min is %d",
+ optarg, MINBSIZE);
+ if (bsize > MAXBSIZE)
+ errx(1, "%s: block size too large, max is %d",
+ optarg, MAXBSIZE);
break;
case 'c':
if ((maxblkspercg = atoi(optarg)) <= 0)
OpenPOWER on IntegriCloud