Fix '-s' option for large disks and fix printing maximum file system size.

This commit is contained in:
Pawel Jakub Dawidek 2004-09-19 10:01:51 +00:00
parent d705e025d0
commit f4d2631187
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=135460

View File

@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$");
#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <inttypes.h>
#include <paths.h>
#include <stdarg.h>
#include <stdio.h>
@ -254,8 +255,10 @@ main(int argc, char *argv[])
optarg);
break;
case 's':
if ((fssize = atoi(optarg)) <= 0)
errx(1, "%s: bad file system size", optarg);
errno = 0;
fssize = strtoimax(optarg, NULL, 0);
if (errno != 0)
err(1, "%s: bad file system size", optarg);
break;
case '?':
default:
@ -295,8 +298,8 @@ main(int argc, char *argv[])
if (fssize == 0)
fssize = mediasize / sectorsize;
else if (fssize > mediasize / sectorsize)
errx(1, "%s: maximum file system size is %u",
special, (u_int)(mediasize / sectorsize));
errx(1, "%s: maximum file system size is %jd",
special, (off_t)(mediasize / sectorsize));
}
pp = NULL;
lp = getdisklabel(special);