Add early backport of JDK-8339414

Resolves: RHEL-97496
This commit is contained in:
Andrew Hughes 2025-07-11 00:17:38 +01:00
parent 84013cf522
commit c6e0cc0dd1
2 changed files with 72 additions and 6 deletions

View File

@ -1605,13 +1605,14 @@ Patch15: jdk8141590-bundle_libffi-followup.patch
#############################################
#
# Patches appearing in 8u382
# Patches appearing in 8u472
#
# This section includes patches which are present
# in the listed OpenJDK 8u release and should be
# able to be removed once that release is out
# and used by this RPM.
#############################################
Patch901: jdk8339414-fix_8202369_backport.patch
#############################################
@ -2053,6 +2054,11 @@ pushd %{top_level_dir_name}
%patch -P539 -p1
popd
# Upstreamed fixes
pushd %{top_level_dir_name}
%patch -P901 -p1
popd
# RPM-only fixes
%patch -P600
%patch -P1003
@ -2970,14 +2976,11 @@ cjc.mainProgram(args)
- Update to 8u462-b08 (GA)
- Update release notes for 8u462-b08.
- Require tzdata 2025b due to upstream inclusion of JDK-8352716
- Add early backport of JDK-8339414
- ** This tarball is embargoed until 2025-07-15 @ 1pm PT. **
- Resolves: RHEL-101648
- Resolves: RHEL-102312
* Sat Jun 14 2025 Andrew Hughes <gnu.andrew@redhat.com> - 1:1.8.0.452.b09-4
- Bump rpmrelease for CentOS build
- Related: RHEL-86967
- Related: RHEL-86620
- Resolves: RHEL-97496
* Sat Jun 14 2025 Andrew Hughes <gnu.andrew@redhat.com> - 1:1.8.0.452.b09-3
- Bump release number to appease 9.6-z erratum

View File

@ -0,0 +1,63 @@
commit 51b6307937d9584f8690e4916444e479eeafff28
Author: Thomas Fitzsimmons <fitzsim@redhat.com>
Date: Mon Jun 16 23:04:07 2025 +0000
8339414: Fix JDK-8202369 incorrect backport for 8u
Reviewed-by: andrew
diff --git a/jdk/src/solaris/native/java/net/Inet4AddressImpl.c b/jdk/src/solaris/native/java/net/Inet4AddressImpl.c
index e30851df576..8b2e3cdce93 100644
--- a/jdk/src/solaris/native/java/net/Inet4AddressImpl.c
+++ b/jdk/src/solaris/native/java/net/Inet4AddressImpl.c
@@ -332,37 +332,33 @@ Java_java_net_Inet4AddressImpl_getHostByAddr(JNIEnv *env, jobject this,
*/
JNIEXPORT jstring JNICALL
Java_java_net_Inet4AddressImpl_getLocalHostName(JNIEnv *env, jobject this) {
- char hostname[NI_MAXHOST+1];
+ char hostname[NI_MAXHOST + 1];
hostname[0] = '\0';
if (JVM_GetHostName(hostname, sizeof(hostname))) {
- /* Something went wrong, maybe networking is not setup? */
strcpy(hostname, "localhost");
} else {
+#if defined(__solaris__)
+ // try to resolve hostname via nameservice
+ // if it is known but getnameinfo fails, hostname will still be the
+ // value from gethostname
struct addrinfo hints, *res;
- int error;
+ // make sure string is null-terminated
hostname[NI_MAXHOST] = '\0';
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_CANONNAME;
hints.ai_family = AF_INET;
- error = getaddrinfo(hostname, NULL, &hints, &res);
-
- if (error == 0) {/* host is known to name service */
- getnameinfo(res->ai_addr,
- res->ai_addrlen,
- hostname,
- NI_MAXHOST,
- NULL,
- 0,
- NI_NAMEREQD);
-
- /* if getnameinfo fails hostname is still the value
- from gethostname */
-
+ if (getaddrinfo(hostname, NULL, &hints, &res) == 0) {
+ getnameinfo(res->ai_addr, res->ai_addrlen, hostname, NI_MAXHOST,
+ NULL, 0, NI_NAMEREQD);
freeaddrinfo(res);
}
+#else
+ // make sure string is null-terminated
+ hostname[NI_MAXHOST] = '\0';
+#endif
}
return (*env)->NewStringUTF(env, hostname);
}