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
This commit is contained in:
parent
75c1311256
commit
59cf6deb68
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=185990
@ -354,11 +354,6 @@ main(int argc, char *argv[])
|
|||||||
mediasize = st.st_size;
|
mediasize = st.st_size;
|
||||||
/* set fssize from the partition */
|
/* set fssize from the partition */
|
||||||
} else {
|
} 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 (sectorsize == 0)
|
||||||
if (ioctl(disk.d_fd, DIOCGSECTORSIZE, §orsize) == -1)
|
if (ioctl(disk.d_fd, DIOCGSECTORSIZE, §orsize) == -1)
|
||||||
sectorsize = 0; /* back out on error for safety */
|
sectorsize = 0; /* back out on error for safety */
|
||||||
@ -368,6 +363,12 @@ main(int argc, char *argv[])
|
|||||||
pp = NULL;
|
pp = NULL;
|
||||||
lp = getdisklabel(special);
|
lp = getdisklabel(special);
|
||||||
if (lp != NULL) {
|
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;
|
cp = &part_name;
|
||||||
if (isdigit(*cp))
|
if (isdigit(*cp))
|
||||||
pp = &lp->d_partitions[RAW_PART];
|
pp = &lp->d_partitions[RAW_PART];
|
||||||
|
Loading…
Reference in New Issue
Block a user