dcavalca / rpms / rpm

Forked from rpms/rpm 2 years ago
Clone
Blob Blame History Raw
From 09fb3830b66fa88162d2e16eeb6c4a63eec9fdfe Mon Sep 17 00:00:00 2001
From: Florian Festi <ffesti@redhat.com>
Date: Mon, 30 Sep 2013 14:17:33 +0200
Subject: [PATCH 1/2] Fix byteorder for 64 bit tags on big endian machines
 (rh#1012946)

---
 lib/header.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/header.c b/lib/header.c
index b24d16e..ceffb32 100644
--- a/lib/header.c
+++ b/lib/header.c
@@ -105,10 +105,12 @@ static const size_t headerMaxbytes = (32*1024*1024);
 RPM_GNUC_CONST
 static uint64_t htonll(uint64_t n)
 {
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
     uint32_t *i = (uint32_t*)&n;
     uint32_t b = i[0];
     i[0] = htonl(i[1]);
     i[1] = htonl(b);
+#endif
     return n;
 }
 
-- 
1.8.3.1