summaryrefslogtreecommitdiffstats
path: root/sbin/gpt/migrate.c
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2004-11-12 04:34:46 +0000
committermarcel <marcel@FreeBSD.org>2004-11-12 04:34:46 +0000
commit3dc93f0071f529bc54cdd1677206626cabaaa3c7 (patch)
treef0934159aa703ebdf3c01f9fe2b9a4d7255cea07 /sbin/gpt/migrate.c
parent1db017cf8c8ba08c9818c167cdb032b4658f75cb (diff)
downloadFreeBSD-src-3dc93f0071f529bc54cdd1677206626cabaaa3c7.zip
FreeBSD-src-3dc93f0071f529bc54cdd1677206626cabaaa3c7.tar.gz
Fix a braino: the partition size in the PMBR is in sectors, not bytes
and 'mediasz' is in bytes. As it so happens, we define 'last' as the sector number of the last sector on the medium which also is the size of the PMBR partition. Therefore, use 'last' instead of 'mediasz'. Submitted by: Dan Markarian <markarian at apple dot com>
Diffstat (limited to 'sbin/gpt/migrate.c')
-rw-r--r--sbin/gpt/migrate.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sbin/gpt/migrate.c b/sbin/gpt/migrate.c
index d9f4074..d0f1485 100644
--- a/sbin/gpt/migrate.c
+++ b/sbin/gpt/migrate.c
@@ -313,12 +313,12 @@ migrate(int fd)
mbr->mbr_part[0].part_esect = 0xff;
mbr->mbr_part[0].part_ecyl = 0xff;
mbr->mbr_part[0].part_start_lo = htole16(1);
- if (mediasz > 0xffffffff) {
+ if (last > 0xffffffff) {
mbr->mbr_part[0].part_size_lo = htole16(0xffff);
mbr->mbr_part[0].part_size_hi = htole16(0xffff);
} else {
- mbr->mbr_part[0].part_size_lo = htole16(mediasz);
- mbr->mbr_part[0].part_size_hi = htole16(mediasz >> 16);
+ mbr->mbr_part[0].part_size_lo = htole16(last);
+ mbr->mbr_part[0].part_size_hi = htole16(last >> 16);
}
gpt_write(fd, map);
}
OpenPOWER on IntegriCloud