Module Name:    src
Committed By:   mlelstv
Date:           Thu Mar 14 10:26:10 UTC 2019

Modified Files:
        src/sbin/gpt: header.c

Log Message:
print little-endian header fields correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sbin/gpt/header.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/gpt/header.c
diff -u src/sbin/gpt/header.c:1.9 src/sbin/gpt/header.c:1.10
--- src/sbin/gpt/header.c:1.9	Tue May  1 08:17:13 2018
+++ src/sbin/gpt/header.c	Thu Mar 14 10:26:10 2019
@@ -33,7 +33,7 @@
 
 #include <sys/cdefs.h>
 #ifdef __RCSID
-__RCSID("$NetBSD: header.c,v 1.9 2018/05/01 08:17:13 martin Exp $");
+__RCSID("$NetBSD: header.c,v 1.10 2019/03/14 10:26:10 mlelstv Exp $");
 #endif
 
 #include <sys/types.h>
@@ -90,11 +90,11 @@ header(gpt_t gpt)
 	revision = le32toh(hdr->hdr_revision);
 	printf("- GPT Header Revision: %u.%u\n", revision >> 16,
 	     revision & 0xffff);
-	gpt_show_num("- First Data Sector", hdr->hdr_lba_start);
-	gpt_show_num("- Last Data Sector", hdr->hdr_lba_end);
+	gpt_show_num("- First Data Sector", le64toh(hdr->hdr_lba_start));
+	gpt_show_num("- Last Data Sector", le64toh(hdr->hdr_lba_end));
 	gpt_uuid_snprintf(buf, sizeof(buf), "%d", hdr->hdr_guid);
 	printf("- Media GUID: %s\n", buf);
-	printf("- Number of GPT Entries: %u\n", hdr->hdr_entries);
+	printf("- Number of GPT Entries: %u\n", le32toh(hdr->hdr_entries));
 	return 0;
 }
 

Reply via email to