diff --git a/src/nss-myhostname/nss-myhostname.c b/src/nss-myhostname/nss-myhostname.c index 93db9d16e7..d574e98a71 100644 --- a/src/nss-myhostname/nss-myhostname.c +++ b/src/nss-myhostname/nss-myhostname.c @@ -345,9 +345,10 @@ enum nss_status _nss_myhostname_gethostbyname3_r( return NSS_STATUS_UNAVAIL; } + if (af == AF_INET6 && !socket_ipv6_is_enabled()) + goto not_found; + if (is_localhost(name)) { - if (af == AF_INET6 && !socket_ipv6_is_enabled()) - goto not_found; canonical = "localhost"; local_address_ipv4 = htobe32(INADDR_LOOPBACK);