gentoo-bootstrap/dev-java/openjdk/files/musl/8/0009_fix_jdk_ipv6_init.patch

44 lines
1.5 KiB
Diff

diff -Naur openjdk-8.265_p01/jdk/src/solaris/native/java/net/net_util_md.c openjdk-8.265_p01-copy/jdk/src/solaris/native/java/net/net_util_md.c
--- openjdk-8.265_p01/jdk/src/solaris/native/java/net/net_util_md.c 2020-10-11 15:53:09.308010360 -0400
+++ openjdk-8.265_p01-copy/jdk/src/solaris/native/java/net/net_util_md.c 2020-10-11 21:32:57.480020246 -0400
@@ -662,7 +662,7 @@
static struct localinterface *localifs = 0;
static int localifsSize = 0; /* size of array */
-static int nifs = 0; /* number of entries used in array */
+static int nifs = -1; /* number of entries used in array */
/* not thread safe: make sure called once from one thread */
@@ -674,6 +674,10 @@
int index, x1, x2, x3;
unsigned int u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,ua,ub,uc,ud,ue,uf;
+ if (nifs >= 0)
+ return ;
+ nifs = 0;
+
if ((f = fopen("/proc/net/if_inet6", "r")) == NULL) {
return ;
}
@@ -702,7 +706,7 @@
localifs = (struct localinterface *) realloc (
localifs, sizeof (struct localinterface)* (localifsSize+5));
if (localifs == 0) {
- nifs = 0;
+ nifs = -1;
fclose (f);
return;
}
@@ -725,9 +729,7 @@
static int getLocalScopeID (char *addr) {
struct localinterface *lif;
int i;
- if (localifs == 0) {
- initLocalIfs();
- }
+ initLocalIfs();
for (i=0, lif=localifs; i<nifs; i++, lif++) {
if (memcmp (addr, lif->localaddr, 16) == 0) {
return lif->index;