parted/parted-1.8.6-off-by-one.patch

26 lines
974 B
Diff

--- parted-1.8.6/parted/parted.c.offbyone 2007-04-11 12:13:06.000000000 -0400
+++ parted-1.8.6/parted/parted.c 2007-04-11 12:13:21.000000000 -0400
@@ -1217,6 +1217,7 @@
static int
do_print (PedDevice** dev)
{
+ PedUnit default_unit;
PedDisk* disk;
Table* table;
StrList* row;
@@ -1303,11 +1304,12 @@
}
start = ped_unit_format (*dev, 0);
+ default_unit = ped_unit_get_default ();
end = ped_unit_format_byte (*dev, (*dev)->length * (*dev)->sector_size
- - 1 );
+ - (default_unit == PED_UNIT_CHS || default_unit == PED_UNIT_CYLINDER));
if (opt_machine_mode) {
- switch (ped_unit_get_default ()) {
+ switch (default_unit) {
case PED_UNIT_CHS: puts ("CHS;");
break;
case PED_UNIT_CYLINDER: puts ("CYL;");