summaryrefslogtreecommitdiff
path: root/sql/hostname.cc
diff options
context:
space:
mode:
authorunknown <joerg@mysql.com>2005-07-27 13:01:48 +0200
committerunknown <joerg@mysql.com>2005-07-27 13:01:48 +0200
commit26ae9152626e21314f1166c23274bb90bfa96b91 (patch)
tree151accb35c2f28d1c746a9ed7d1ca5efbd32a479 /sql/hostname.cc
parent46b0edc444c0dffafbbce8ef5b65f61a0224bef1 (diff)
downloadmariadb-git-26ae9152626e21314f1166c23274bb90bfa96b91.tar.gz
Fix shortcircuit of 127.0.0.1 -> localhost lookup on little-endian machines. (Bug #11822)
(Originally: 1.1891 05/07/25 12:07:47 jimw@mysql.com ) configure.in: Modify version number. sql/hostname.cc: Fix comparison against INADDR_LOOPBACK to deal with endianness. (Originally applied to "sql/hostname.cpp": 1.31 05/07/25 12:07:44 jimw@mysql.com )
Diffstat (limited to 'sql/hostname.cc')
-rw-r--r--sql/hostname.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/hostname.cc b/sql/hostname.cc
index 12b69a97859..3b1eeb63d37 100644
--- a/sql/hostname.cc
+++ b/sql/hostname.cc
@@ -143,8 +143,8 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors)
*errors=0;
/* We always treat the loopback address as "localhost". */
- if (in->s_addr == INADDR_LOOPBACK)
- return (char *)my_localhost;
+ if (in->s_addr == htonl(INADDR_LOOPBACK)) // is expanded inline by gcc
+ DBUG_RETURN((char *)my_localhost);
/* Check first if we have name in cache */
if (!(specialflag & SPECIAL_NO_HOST_CACHE))