From: Karel Zak Date: Tue, 12 Apr 2022 09:56:40 +0000 (+0200) Subject: libfdisk: (gpt) add comment X-Git-Tag: v2.39-rc1~717 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=654a443a628e21cc1ab016ff227fc81563b13c6e;p=thirdparty%2Futil-linux.git libfdisk: (gpt) add comment Signed-off-by: Karel Zak --- diff --git a/libfdisk/src/gpt.c b/libfdisk/src/gpt.c index c6f482fd86..c132739b2b 100644 --- a/libfdisk/src/gpt.c +++ b/libfdisk/src/gpt.c @@ -2122,13 +2122,14 @@ static int gpt_write_pmbr(struct fdisk_context *cxt) pmbr->partition_record[0].size_in_lba = cpu_to_le32((uint32_t) (cxt->total_sectors - 1ULL)); + /* Read the current PMBR and compare it with the new, don't write if + * the same. */ current = malloc(sizeof(*current)); if (!current) goto do_write; rc = gpt_read(cxt, GPT_PMBR_LBA * cxt->sector_size, current, cxt->sector_size); - if (!rc) rc = memcmp(pmbr, current, sizeof(*current));