From b31522861f8cd56ac3a93db2aaa41b76dc85baeb Mon Sep 17 00:00:00 2001 From: dsl Date: Mon, 10 May 2004 20:32:07 +0000 Subject: [PATCH] Use the disk size from the device driver, not the bios when checking whether partitions are valid. Stops problems with broken BIOS, fixes PR bin/25491 --- sbin/fdisk/fdisk.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c index 9bc8e21ed0d1..d08c2a075049 100644 --- a/sbin/fdisk/fdisk.c +++ b/sbin/fdisk/fdisk.c @@ -1,4 +1,4 @@ -/* $NetBSD: fdisk.c,v 1.78 2004/05/08 20:52:59 dsl Exp $ */ +/* $NetBSD: fdisk.c,v 1.79 2004/05/10 20:32:07 dsl Exp $ */ /* * Mach Operating System @@ -35,7 +35,7 @@ #include #ifndef lint -__RCSID("$NetBSD: fdisk.c,v 1.78 2004/05/08 20:52:59 dsl Exp $"); +__RCSID("$NetBSD: fdisk.c,v 1.79 2004/05/10 20:32:07 dsl Exp $"); #endif /* not lint */ #include @@ -1544,7 +1544,7 @@ check_overlap(int part, int sysid, daddr_t start, daddr_t size, int fix) if (sysid != 0) { if (start < dos_sectors) return "Track zero is reserved for the BIOS"; - if (start + size > dos_disksectors) + if (start + size > disksectors) return "Partition exceeds size of disk"; for (p = 0; p < MBR_PART_COUNT; p++) { if (p == part || mboot.mbr_parts[p].mbrp_type == 0) @@ -1809,7 +1809,7 @@ change_part(int extended, int part, int sysid, daddr_t start, daddr_t size, p = -1; } } - if (start >= dos_disksectors) { + if (start >= disksectors) { printf("No free space\n"); return 0; } @@ -1829,7 +1829,7 @@ change_part(int extended, int part, int sysid, daddr_t start, daddr_t size, #endif } else { daddr_t old = start; - daddr_t lim = extended ? ext.limit : dos_disksectors; + daddr_t lim = extended ? ext.limit : disksectors; start = decimal("start", start, DEC_SEC | DEC_RND_0 | (extended ? DEC_RND : 0), extended ? ext.base : 0, lim);