summaryrefslogtreecommitdiff
path: root/storage/sphinx/ha_sphinx.cc
diff options
context:
space:
mode:
Diffstat (limited to 'storage/sphinx/ha_sphinx.cc')
-rw-r--r--storage/sphinx/ha_sphinx.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/storage/sphinx/ha_sphinx.cc b/storage/sphinx/ha_sphinx.cc
index 13a46d495fe..812b362e737 100644
--- a/storage/sphinx/ha_sphinx.cc
+++ b/storage/sphinx/ha_sphinx.cc
@@ -2163,7 +2163,7 @@ int ha_sphinx::Connect ( const char * sHost, ushort uPort )
#if MYSQL_VERSION_ID>=50515
struct addrinfo *hp = NULL;
tmp_errno = getaddrinfo ( sHost, NULL, NULL, &hp );
- if ( !tmp_errno || !hp || !hp->ai_addr )
+ if ( tmp_errno || !hp || !hp->ai_addr )
{
bError = true;
if ( hp )
@@ -2190,8 +2190,9 @@ int ha_sphinx::Connect ( const char * sHost, ushort uPort )
}
#if MYSQL_VERSION_ID>=50515
- memcpy ( &sin.sin_addr, hp->ai_addr, Min ( sizeof(sin.sin_addr), (size_t)hp->ai_addrlen ) );
- freeaddrinfo ( hp );
+ struct sockaddr_in *in = (sockaddr_in *)hp->ai_addr;
+ memcpy ( &sin.sin_addr, &in->sin_addr, Min ( sizeof(sin.sin_addr), sizeof(in->sin_addr) ) );
+ freeaddrinfo ( hp );
#else
memcpy ( &sin.sin_addr, hp->h_addr, Min ( sizeof(sin.sin_addr), (size_t)hp->h_length ) );
my_gethostbyname_r_free();