From 654a443a628e21cc1ab016ff227fc81563b13c6e Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 12 Apr 2022 11:56:40 +0200 Subject: [PATCH] libfdisk: (gpt) add comment Signed-off-by: Karel Zak --- libfdisk/src/gpt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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)); -- 2.47.2