From: Karel Zak Date: Mon, 23 Jul 2012 09:08:26 +0000 (+0200) Subject: fdisk: get_boot() has to die (step II.) X-Git-Tag: v2.22-rc1~106 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=84e18f7659ed8d311a5549936afba7f6d2101a79;p=thirdparty%2Futil-linux.git fdisk: get_boot() has to die (step II.) Signed-off-by: Karel Zak --- diff --git a/fdisks/fdisk.c b/fdisks/fdisk.c index e24dd3bf45..1340ca49b9 100644 --- a/fdisks/fdisk.c +++ b/fdisks/fdisk.c @@ -513,20 +513,6 @@ update_sector_offset(struct fdisk_context *cxt) } } -/* - * Read MBR. Returns: - * -1: no 0xaa55 flag present (possibly entire disk BSD) - * 0: found or created label - * 1: I/O error - */ -static int get_boot(struct fdisk_context *cxt, int try_only) { - if (disklabel == ANY_LABEL) { - if (try_only) - return -1; - } - return 0; -} - static int is_partition_table_changed(void) { int i; @@ -1763,14 +1749,18 @@ static void print_partition_table_from_option(char *device, unsigned long sector fdisk_context_set_user_geometry(cxt, user_cylinders, user_heads, user_sectors); gpt_warning(device); - gb = get_boot(cxt, 1); - if (gb < 0) { /* no DOS signature */ + + if (!fdisk_dev_has_disklabel(cxt)) { + /* + * Try BSD -- TODO: move to list_table() too + */ list_disk_geometry(cxt); if (disklabel != AIX_LABEL && disklabel != MAC_LABEL) btrydev(cxt); } - else if (!gb) + else list_table(cxt, 0); + fdisk_free_context(cxt); cxt = NULL; }