]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: (gpt) add comment
authorKarel Zak <kzak@redhat.com>
Tue, 12 Apr 2022 09:56:40 +0000 (11:56 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 12 Apr 2022 09:56:40 +0000 (11:56 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk/src/gpt.c

index c6f482fd861c83c6e15beb8ba1168aae2cddb387..c132739b2bfa43a9aec1e1d888b5e8d9efcd4b1a 100644 (file)
@@ -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));