diff options
author | luigi <luigi@FreeBSD.org> | 2008-12-12 15:56:38 +0000 |
---|---|---|
committer | luigi <luigi@FreeBSD.org> | 2008-12-12 15:56:38 +0000 |
commit | 3e21de6755bffe8880f9fc3b7887ff396b13e7fe (patch) | |
tree | 04d7c4e9f7063aed227989adcbbbdf114d7743bc /sbin/newfs | |
parent | 11052945463dd2688a36a3e60e096d7850629d8e (diff) | |
download | FreeBSD-src-3e21de6755bffe8880f9fc3b7887ff396b13e7fe.zip FreeBSD-src-3e21de6755bffe8880f9fc3b7887ff396b13e7fe.tar.gz |
Move the check for the ending char in the partition name where
it was before -- the check is only made when getdisklabel()
returns valid info.
On passing, use MAXPARTITIONS to identify the max partition number,
instead of the hardwired 'h'
MFC after: 4 weeks
Diffstat (limited to 'sbin/newfs')
-rw-r--r-- | sbin/newfs/newfs.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c index 269707b..d27071f 100644 --- a/sbin/newfs/newfs.c +++ b/sbin/newfs/newfs.c @@ -354,11 +354,6 @@ main(int argc, char *argv[]) mediasize = st.st_size; /* set fssize from the partition */ } else { - part_name = special[strlen(special) - 1]; - if ((part_name < 'a' || part_name > 'h') && !isdigit(part_name)) - errx(1, "%s: can't figure out file system partition", - special); - if (sectorsize == 0) if (ioctl(disk.d_fd, DIOCGSECTORSIZE, §orsize) == -1) sectorsize = 0; /* back out on error for safety */ @@ -368,6 +363,12 @@ main(int argc, char *argv[]) pp = NULL; lp = getdisklabel(special); if (lp != NULL) { + if (!is_file) /* already set for files */ + part_name = special[strlen(special) - 1]; + if ((part_name < 'a' || part_name - 'a' >= MAXPARTITIONS) && + !isdigit(part_name)) + errx(1, "%s: can't figure out file system partition", + special); cp = &part_name; if (isdigit(*cp)) pp = &lp->d_partitions[RAW_PART]; |