diff options
Diffstat (limited to 'libfdisk')
-rw-r--r-- | libfdisk/src/sun.c | 8 | ||||
-rw-r--r-- | libfdisk/src/table.c | 6 |
2 files changed, 8 insertions, 6 deletions
diff --git a/libfdisk/src/sun.c b/libfdisk/src/sun.c index babff6263..d99c39f6f 100644 --- a/libfdisk/src/sun.c +++ b/libfdisk/src/sun.c @@ -957,9 +957,11 @@ static int sun_write_disklabel(struct fdisk_context *cxt) sunlabel->nhead = cpu_to_be16(cxt->geom.heads); sunlabel->nsect = cpu_to_be16(cxt->geom.sectors); - if (cxt->geom.cylinders != be16_to_cpu(sunlabel->ncyl)) - sunlabel->ncyl = cpu_to_be16( cxt->geom.cylinders - - be16_to_cpu(sunlabel->acyl) ); + if (cxt->geom.cylinders != be16_to_cpu(sunlabel->ncyl)) { + int a = cpu_to_be16(cxt->geom.cylinders); + int b = be16_to_cpu(sunlabel->acyl); + sunlabel->ncyl = a - b; + } ush = (unsigned short *) sunlabel; diff --git a/libfdisk/src/table.c b/libfdisk/src/table.c index 1add09fca..923481452 100644 --- a/libfdisk/src/table.c +++ b/libfdisk/src/table.c @@ -437,16 +437,16 @@ static int table_add_freespace( } while (fdisk_table_next_partition(tb, &itr, &x) == 0) { - fdisk_sector_t end, best_end = 0; + fdisk_sector_t the_end, best_end = 0; if (!fdisk_partition_has_end(x)) continue; - end = fdisk_partition_get_end(x); + the_end = fdisk_partition_get_end(x); if (best) best_end = fdisk_partition_get_end(best); - if (end < pa->start && (!best || best_end < end)) + if (the_end < pa->start && (!best || best_end < the_end)) best = x; } |