diff options
author | pjd <pjd@FreeBSD.org> | 2004-09-19 10:01:51 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2004-09-19 10:01:51 +0000 |
commit | 0eac437676f2e77231ee2391fea1689498186611 (patch) | |
tree | 8ae8b0ab84f84eb93931e3da8084d755205c7036 /sbin/newfs | |
parent | 73cf913d5f9c8b5932556b4f8630059a82fe0b22 (diff) | |
download | FreeBSD-src-0eac437676f2e77231ee2391fea1689498186611.zip FreeBSD-src-0eac437676f2e77231ee2391fea1689498186611.tar.gz |
Fix '-s' option for large disks and fix printing maximum file system size.
Diffstat (limited to 'sbin/newfs')
-rw-r--r-- | sbin/newfs/newfs.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c index 3a723f8..f39b55b 100644 --- a/sbin/newfs/newfs.c +++ b/sbin/newfs/newfs.c @@ -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); |