< prev index next >
src/solaris/native/java/net/Inet6AddressImpl.c
Print this page
rev 12042 : 8169865: Downport minor fixes in java.net native code from JDK 9 to JDK 8
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -73,22 +73,18 @@
/* Something went wrong, maybe networking is not setup? */
strcpy(hostname, "localhost");
} else {
// ensure null-terminated
hostname[NI_MAXHOST] = '\0';
-#if defined(__linux__) || defined(_ALLBSD_SOURCE)
- /* On Linux/FreeBSD gethostname() says "host.domain.sun.com". On
- * Solaris gethostname() says "host", so extra work is needed.
- */
-#else
+
/* Solaris doesn't want to give us a fully qualified domain name.
* We do a reverse lookup to try and get one. This works
* if DNS occurs before NIS in /etc/resolv.conf, but fails
* if NIS comes first (it still gets only a partial name).
* We use thread-safe system calls.
*/
-#ifdef AF_INET6
+#if defined(__solaris__) && defined(AF_INET6)
struct addrinfo hints, *res;
int error;
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_CANONNAME;
@@ -109,12 +105,11 @@
/* if getnameinfo fails hostname is still the value
from gethostname */
freeaddrinfo(res);
}
-#endif /* AF_INET6 */
-#endif /* __linux__ || _ALLBSD_SOURCE */
+#endif
}
return (*env)->NewStringUTF(env, hostname);
}
#ifdef MACOSX
< prev index next >