From 42c14ca576620cc0a90acc74312848f9a87944ff Mon Sep 17 00:00:00 2001
From: g0dil <g0dil@wiback.org>
Date: Tue, 25 Nov 2008 12:55:23 +0000
Subject: [PATCH] Socket/Protocols: (hopefully) fix sockaddr alignment issues
 on 64bit

---
 Socket/Protocols/BSDSocketAddress.hh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/Socket/Protocols/BSDSocketAddress.hh b/Socket/Protocols/BSDSocketAddress.hh
index 5afd329d0..9fbc5f01a 100644
--- a/Socket/Protocols/BSDSocketAddress.hh
+++ b/Socket/Protocols/BSDSocketAddress.hh
@@ -27,6 +27,8 @@
 #define HH_SENF_Socket_Protocols_BSDSocketAddress_ 1
 
 // Custom includes
+#include <boost/type_traits/alignment_of.hpp>
+#include <boost/type_traits/type_with_alignment.hpp>
 #include "../../Utils/safe_bool.hh"
 #include <sys/socket.h>
 #include <iostream>
@@ -113,7 +115,10 @@ namespace senf {
 
     private:
 
-        socklen_t len_;
+        union {
+            socklen_t len_;
+            boost::type_with_alignment<boost::alignment_of<struct sockaddr_storage>::value> _;
+        };
     };
 
     /** \brief Safe socket address down-cast
-- 
GitLab