File 0003-QPID-3650-Avoid-unaligned-memory-access.patch of Package qpid
From 8fddcd34bb11b47fe28b693b1223e9232dba91c5 Mon Sep 17 00:00:00 2001
From: Andrew Stitcher <astitcher@apache.org>
Date: Tue, 10 Jun 2014 21:55:45 +0000
Subject: [PATCH 3/4] QPID-3650: Avoid unaligned memory access
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1601779 13f79535-47bb-0310-9956-ffa450edef68
---
qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp b/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp
index 78bcdec..2cc6573 100644
--- a/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp
+++ b/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp
@@ -200,7 +200,11 @@ namespace Rdma {
if (!buff) {
Buffer* ob = getSendBuffer();
// Have to send something as adapters hate it when you try to transfer 0 bytes
- *reinterpret_cast< uint32_t* >(ob->bytes()) = htonl(credit);
+ char* bytes = ob->bytes();
+ bytes[0] = 0xFF & (credit >> 24);
+ bytes[1] = 0xFF & (credit >> 16);
+ bytes[2] = 0xFF & (credit >> 8);
+ bytes[3] = 0xFF & (credit );
ob->dataCount(sizeof(uint32_t));
qp->postSend(credit | IgnoreData, ob);
} else if (credit > 0) {
--
1.9.3