The cfdisk and fdisk set defaults for heads and sectors in order to handle a
situation when the get_geometry() ends up with zeroes for the disk geometry for
device-mapper devices. This patch add same functionally to sfdisk.
You know that a dmsetup setgeometry of the the dm device can be used to
circumvent the issue but users may not immediately realize they need to do
that.
R = get_geometry(dev, fd, silent);
- B.heads = (U.heads ? U.heads : R.heads);
- B.sectors = (U.sectors ? U.sectors : R.sectors);
+ B.heads = (U.heads ? U.heads : R.heads ? R.heads : 255);
+ B.sectors = (U.sectors ? U.sectors : R.sectors ? R.sectors : 63);
B.cylinders = (U.cylinders ? U.cylinders : R.cylinders);
B.cylindersize = B.heads * B.sectors;