diff --git a/daemon/parted.c b/daemon/parted.c index ef7b90056..3a723762c 100644 --- a/daemon/parted.c +++ b/daemon/parted.c @@ -341,7 +341,7 @@ get_table_field (const char *line, int n) } static char * -print_partition_table (const char *device, bool add_m_option) +print_partition_table (const char *device) { char *out; CLEANUP_FREE char *err = NULL; @@ -349,14 +349,9 @@ print_partition_table (const char *device, bool add_m_option) udev_settle (); - if (add_m_option) - r = command (&out, &err, "parted", "-m", "-s", "--", device, - "unit", "b", - "print", NULL); - else - r = command (&out, &err, "parted", "-s", "--", device, - "unit", "b", - "print", NULL); + r = command (&out, &err, "parted", "-m", "-s", "--", device, + "unit", "b", + "print", NULL); udev_settle (); @@ -383,7 +378,7 @@ do_part_get_bootable (const char *device, int partnum) return -1; } - CLEANUP_FREE char *out = print_partition_table (device, true); + CLEANUP_FREE char *out = print_partition_table (device); if (!out) return -1; @@ -555,7 +550,7 @@ do_part_get_name (const char *device, int partnum) return NULL; if (STREQ (parttype, "gpt")) { - CLEANUP_FREE char *out = print_partition_table (device, true); + CLEANUP_FREE char *out = print_partition_table (device); if (!out) return NULL; diff --git a/daemon/parted.ml b/daemon/parted.ml index 45c387987..29b98c480 100644 --- a/daemon/parted.ml +++ b/daemon/parted.ml @@ -57,10 +57,8 @@ let part_get_mbr_id device partnum = (* It's printed in hex, possibly with a leading space. *) sscanf out " %x" identity -(* This is not equivalent to print_partition_table in the C code, as - * it only deals with the ‘-m’ option output, and it partially parses - * that. If we convert other functions that don't use the ‘-m’ version - * we'll have to refactor this. XXX +(* This is almost equivalent to print_partition_table in the C code. The + * difference is that here we enforce the "BYT;" header internally. *) let print_partition_table_machine_readable device = udev_settle ();