MFC: Fix '-s' option for large disks and fix printing maximum file system size. Index: sbin/newfs/newfs.c =================================================================== RCS file: /private/FreeBSD/src/sbin/newfs/newfs.c,v retrieving revision 1.76 retrieving revision 1.77 diff -u -p -r1.76 -r1.77 --- sbin/newfs/newfs.c 9 Apr 2004 19:58:34 -0000 1.76 +++ sbin/newfs/newfs.c 19 Sep 2004 10:01:51 -0000 1.77 @@ -48,7 +48,7 @@ static char sccsid[] = "@(#)newfs.c 8.13 #endif /* not lint */ #endif #include -__FBSDID("$FreeBSD: src/sbin/newfs/newfs.c,v 1.76 2004/04/09 19:58:34 markm Exp $"); +__FBSDID("$FreeBSD: src/sbin/newfs/newfs.c,v 1.77 2004/09/19 10:01:51 pjd Exp $"); /* * newfs: friendly front end to mkfs @@ -68,6 +68,7 @@ __FBSDID("$FreeBSD: src/sbin/newfs/newfs #include #include #include +#include #include #include #include @@ -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);