When rounding a partition to end on a cylinder boundary, round the start

down to a cylinder boundary before adding in the requested size.
Stops the partition being one cylinder larger than requested when the
partition doesn't start at the beginning of a cylinder (eg for partitions
starting in sector 63).
Fixes part of PR install/23548
This commit is contained in:
dsl 2003-11-27 21:43:22 +00:00
parent 7983f217c9
commit 2726af786f
1 changed files with 5 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: mbr.c,v 1.55 2003/10/19 20:17:31 dsl Exp $ */
/* $NetBSD: mbr.c,v 1.56 2003/11/27 21:43:22 dsl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -636,9 +636,12 @@ edit_mbr_size(menudesc *m, void *arg)
else {
/* Round end to cylinder boundary */
if (sizemult != 1) {
new = start + new * sizemult;
new *= sizemult;
new += ROUNDDOWN(start, bcylsize);
new = ROUNDUP(new, bcylsize);
new -= start;
while (new <= 0)
new += bcylsize;
}
}
}