wuyuoss / rpms / rpm

Forked from rpms/rpm 3 years ago
Clone
5860f5
From 09fb3830b66fa88162d2e16eeb6c4a63eec9fdfe Mon Sep 17 00:00:00 2001
5860f5
From: Florian Festi <ffesti@redhat.com>
5860f5
Date: Mon, 30 Sep 2013 14:17:33 +0200
5860f5
Subject: [PATCH 1/2] Fix byteorder for 64 bit tags on big endian machines
5860f5
 (rh#1012946)
5860f5
5860f5
---
5860f5
 lib/header.c | 2 ++
5860f5
 1 file changed, 2 insertions(+)
5860f5
5860f5
diff --git a/lib/header.c b/lib/header.c
5860f5
index b24d16e..ceffb32 100644
5860f5
--- a/lib/header.c
5860f5
+++ b/lib/header.c
5860f5
@@ -105,10 +105,12 @@ static const size_t headerMaxbytes = (32*1024*1024);
5860f5
 RPM_GNUC_CONST
5860f5
 static uint64_t htonll(uint64_t n)
5860f5
 {
5860f5
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
5860f5
     uint32_t *i = (uint32_t*)&n;
5860f5
     uint32_t b = i[0];
5860f5
     i[0] = htonl(i[1]);
5860f5
     i[1] = htonl(b);
5860f5
+#endif
5860f5
     return n;
5860f5
 }
5860f5
 
5860f5
-- 
5860f5
1.8.3.1
5860f5