From 88c16ab5e40aafdfa8ae4d36c70089746d77747b Mon Sep 17 00:00:00 2001 From: HATAYAMA Daisuke Date: Fri, 13 Sep 2013 16:20:46 +0900 Subject: [PATCH 2/2] sadump: convert the first three fields of EFI GUID from little-endian into big-endian Although RFC 4122 recommends network byte order for all fields of UUID, EFI GUID uses little-endian for the first three fields TimeLow, TimeMid and TimeHighAndVersion. Thus, in text representation of the GUID, converting the three fields from little-endian into big-endian is needed. Signed-off-by: HATAYAMA Daisuke --- sadump.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sadump.c b/sadump.c index 5af29ad..6972b1c 100644 --- a/sadump.c +++ b/sadump.c @@ -18,6 +18,7 @@ #include "defs.h" #include "sadump.h" +#include /* htonl, htons */ #include enum { @@ -865,7 +866,7 @@ guid_to_str(efi_guid_t *guid, char *buf, size_t buflen) { snprintf(buf, buflen, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", - guid->data1, guid->data2, guid->data3, + htonl(guid->data1), htons(guid->data2), htons(guid->data3), guid->data4[0], guid->data4[1], guid->data4[2], guid->data4[3], guid->data4[4], guid->data4[5], guid->data4[6], guid->data4[7]); -- 1.8.3.1