com32/chain: manglepe_fixchs() correction
commited26fef5f0f0deb56abc68857b139c93e5486813
authorMichal Soltys <soltys@ziu.info>
Thu, 14 Feb 2013 15:51:46 +0000 (14 16:51 +0100)
committerMichal Soltys <soltys@ziu.info>
Thu, 14 Feb 2013 15:53:05 +0000 (14 16:53 +0100)
tree8bae4ad4b10fd1c309d144b730d91983561b7e32
parentb5849a4d28bec1616ac4d2aa67b4ca5b3de55144
com32/chain: manglepe_fixchs() correction

We have to be more careful, when in-entry start/length values are 0 (one
or both). Firstly they are relative to the disk or the [B]EBR (while CHS
are absolute). Secondly, length 0 would imply the end CHS being lower
than the start CHS.

Under normal circumstances, partiter would complain about corrupt layout
(unless relax flag is set) and value 0 in any of those fields generally
imply a hole, so the adjustments were harmless - nontheless they made
everything look silly and not really correct.

Adjusted approach is:

- for start entry - if the os entry is 0 /and/ the beginning is 0 -
  reset to 0, otherwise calculate chs
- for end entry - as above /or/ length is 0 - reset to 0, otherwise
  calculate chs

Signed-off-by: Michal Soltys <soltys@ziu.info>
com32/chain/mangle.c