aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-05-10 23:32:18 +0000
committerlloyd <[email protected]>2010-05-10 23:32:18 +0000
commit3c6147792fa42df7ee9ed614cee0f79711f393d3 (patch)
treec0a0306a4ffe9b6636f7e03565f5d4ea492882ac
parent4d24795df59e87043284fa2d9ea79c93ee0b75a9 (diff)
Use memcpy to copy gethostbyname's result to the socket info struct
instead of doing cast+assign - GCC on SPARC rejects because the required alignment increases.
-rw-r--r--src/ssl/unix_socket/unx_sock.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ssl/unix_socket/unx_sock.cpp b/src/ssl/unix_socket/unx_sock.cpp
index f9d9629fb..9954cdc06 100644
--- a/src/ssl/unix_socket/unx_sock.cpp
+++ b/src/ssl/unix_socket/unx_sock.cpp
@@ -41,6 +41,11 @@ Unix_Socket::Unix_Socket(const std::string& host, u16bit port) : peer(host)
::memset(&socket_info, 0, sizeof(socket_info));
socket_info.sin_family = AF_INET;
socket_info.sin_port = htons(port);
+
+ ::memcpy(&socket_info.sin_addr,
+ host_addr->h_addr,
+ host_addr->h_length);
+
socket_info.sin_addr = *(struct in_addr*)host_addr->h_addr; // FIXME
if(::connect(fd, (sockaddr*)&socket_info, sizeof(struct sockaddr)) != 0)