summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authordavide <davide@FreeBSD.org>2014-09-18 03:11:59 +0000
committerdavide <davide@FreeBSD.org>2014-09-18 03:11:59 +0000
commitfa58e15782ffccfd3ab0b630b0e03e9ee1d72356 (patch)
tree6981627f673d6d3a2e04b30ca463247568957df5 /usr.sbin
parent80e51d9d11a7fa765dd0377f1c35f2e5b5d6af54 (diff)
downloadFreeBSD-src-fa58e15782ffccfd3ab0b630b0e03e9ee1d72356.zip
FreeBSD-src-fa58e15782ffccfd3ab0b630b0e03e9ee1d72356.tar.gz
r258695 introduces a sanity check for makefs in order to verify that
the minimum image size specified is always less than the maximum image size. If makefs(1) is invoked specifying minimum image size, but not maximum one, the program exits with an error. Example: # sudo -E makefs -M 538968064 -B be /home/davide/disk.img $DESTDIR makefs: `/home/davide/tftproot/mips' minsize of 538968064 rounded up to ffs bsize of 8192 exceeds maxsize 0. Lower bsize, or round the minimum and maximum sizes to bsize. Assert then that minsize < maxsize iff maxsize is specified. This change allows me to build MIPS images using makefs(1) and following what specified in the wiki again. Reviewed by: jmallett, ngie
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/makefs/ffs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.sbin/makefs/ffs.c b/usr.sbin/makefs/ffs.c
index 92d5508..9fd87ae 100644
--- a/usr.sbin/makefs/ffs.c
+++ b/usr.sbin/makefs/ffs.c
@@ -361,7 +361,8 @@ ffs_validate(const char *dir, fsnode *root, fsinfo_t *fsopts)
if (ffs_opts->avgfpdir == -1)
ffs_opts->avgfpdir = AFPDIR;
- if (roundup(fsopts->minsize, ffs_opts->bsize) > fsopts->maxsize)
+ if (fsopts->maxsize > 0 &&
+ roundup(fsopts->minsize, ffs_opts->bsize) > fsopts->maxsize)
errx(1, "`%s' minsize of %lld rounded up to ffs bsize of %d "
"exceeds maxsize %lld. Lower bsize, or round the minimum "
"and maximum sizes to bsize.", dir,
OpenPOWER on IntegriCloud