Commit ec8617c6 authored by unknown's avatar unknown

Fix shortcircuit of 127.0.0.1 -> localhost lookup on little-endian

machines. (Bug #11822)


sql/hostname.cc:
  Fix comparison against INADDR_LOOPBACK to deal with endianness.
parent c15cab96
...@@ -143,8 +143,8 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors) ...@@ -143,8 +143,8 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors)
*errors=0; *errors=0;
/* We always treat the loopback address as "localhost". */ /* We always treat the loopback address as "localhost". */
if (in->s_addr == INADDR_LOOPBACK) if (in->s_addr == htonl(INADDR_LOOPBACK))
return (char *)my_localhost; DBUG_RETURN((char *)my_localhost);
/* Check first if we have name in cache */ /* Check first if we have name in cache */
if (!(specialflag & SPECIAL_NO_HOST_CACHE)) if (!(specialflag & SPECIAL_NO_HOST_CACHE))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment