From 5f64a0e24df9caea7d3c6c51f9c605e10fb48358 Mon Sep 17 00:00:00 2001 From: dsl Date: Wed, 20 Oct 2004 19:36:23 +0000 Subject: [PATCH] Fix equivalent of PR/26917 - this code was stolen from fdisk. (similtaneus eqns to determine bios geometry from mbr entries could divide by zero) --- distrib/utils/sysinst/mbr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/distrib/utils/sysinst/mbr.c b/distrib/utils/sysinst/mbr.c index 23e2f210a00e..5d30a95743c0 100644 --- a/distrib/utils/sysinst/mbr.c +++ b/distrib/utils/sysinst/mbr.c @@ -1,4 +1,4 @@ -/* $NetBSD: mbr.c,v 1.65 2004/10/16 13:20:11 dsl Exp $ */ +/* $NetBSD: mbr.c,v 1.66 2004/10/20 19:36:23 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -1689,10 +1689,10 @@ guess_biosgeom_from_mbr(mbr_info_t *mbri, int *cyl, int *head, int *sec) for (i = 0; i < MBR_PART_COUNT * 2 - 1; i++) { if (get_mapping(parts, i, &c1, &h1, &s1, &a1) < 0) continue; + a1 -= s1; for (j = i + 1; j < MBR_PART_COUNT * 2; j++) { if (get_mapping(parts, j, &c2, &h2, &s2, &a2) < 0) continue; - a1 -= s1; a2 -= s2; num = (uint64_t)h1 * a2 - (quad_t)h2 * a1; denom = (uint64_t)c2 * a1 - (quad_t)c1 * a2;