summaryrefslogtreecommitdiff
path: root/sbin/fdisk/gpt.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2021-12-29 00:04:46 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2021-12-29 00:04:46 +0000
commitbbca0f4cd6aadda42c71908495618d685c2d41a4 (patch)
tree36aa83a118121c01190db06be918854b0469d730 /sbin/fdisk/gpt.c
parent67e884bb1bda3dd0a9b45a10649e74e78aeef303 (diff)
Tweak some DEBUG output.
Always put '0x' prefix in front of displayed hex values, i.e. the checksums. Add missing letoh32() so bad endian checksum is clear. Be consistent when displaying 'expected' and 'got' checksums, i.e. 'expected' == calculated checksum and 'got' == checksum found in GPT.
Diffstat (limited to 'sbin/fdisk/gpt.c')
-rw-r--r--sbin/fdisk/gpt.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sbin/fdisk/gpt.c b/sbin/fdisk/gpt.c
index 6547d930867..eb23259bde9 100644
--- a/sbin/fdisk/gpt.c
+++ b/sbin/fdisk/gpt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gpt.c,v 1.54 2021/12/28 23:44:02 krw Exp $ */
+/* $OpenBSD: gpt.c,v 1.55 2021/12/29 00:04:45 krw Exp $ */
/*
* Copyright (c) 2015 Markus Muller <mmu@grummel.net>
* Copyright (c) 2015 Kenneth R Westerback <krw@openbsd.org>
@@ -165,9 +165,9 @@ get_header(const uint64_t sector)
gh.gh_csum = 0;
new_gh_csum = crc32((unsigned char *)&gh, letoh32(gh.gh_size));
gh.gh_csum = orig_gh_csum;
- if (letoh32(orig_gh_csum) != new_gh_csum) {
+ if (new_gh_csum != letoh32(gh.gh_csum)) {
DPRINTF("gpt header checksum: expected 0x%x, got 0x%x\n",
- orig_gh_csum, new_gh_csum);
+ new_gh_csum, letoh32(gh.gh_csum));
return -1;
}
@@ -244,8 +244,8 @@ get_partition_table(void)
checksum = crc32((unsigned char *)&gp, gpbytes);
if (checksum != letoh32(gh.gh_part_csum)) {
- DPRINTF("gpt partition table checksum: expected %x, got %x\n",
- checksum, letoh32(gh.gh_part_csum));
+ DPRINTF("gpt partition table checksum: expected 0x%x, "
+ "got 0x%x\n", checksum, letoh32(gh.gh_part_csum));
return -1;
}