From: Karel Zak Date: Fri, 11 Oct 2013 09:38:29 +0000 (+0200) Subject: libfdisk: treat size mismatch as a warning, not an error X-Git-Tag: v2.24-rc2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=59db52ad473cccc7c0005d99d03c9dd0d41d7797;p=thirdparty%2Futil-linux.git libfdisk: treat size mismatch as a warning, not an error Based on kernel patch from Doug Anderson . Signed-off-by: Karel Zak --- diff --git a/libfdisk/src/gpt.c b/libfdisk/src/gpt.c index 448b1ff79b..6d222061a2 100644 --- a/libfdisk/src/gpt.c +++ b/libfdisk/src/gpt.c @@ -509,11 +509,18 @@ check_hybrid: * the disk size. * * Hybrid MBRs do not necessarily comply with this. + * + * Consider a bad value here to be a warning to support dd-ing + * an image from a smaller disk to a bigger disk. */ if (ret == GPT_MBR_PROTECTIVE) { sz_lba = le32_to_cpu(pmbr->partition_record[part].size_in_lba); - if (sz_lba != (uint32_t) cxt->total_sectors - 1 && sz_lba != 0xFFFFFFFF) - ret = 0; + if (sz_lba != (uint32_t) cxt->total_sectors - 1 && sz_lba != 0xFFFFFFFF) { + fdisk_warnx(cxt, _("GPT PMBR size mismatch (%u != %u) " + "will be corrected by w(rite)."), + sz_lba, + (uint32_t) cxt->total_sectors - 1); + } } done: return ret;