Skip to content

Commit fb68395

Browse files
8259014: (so) ServerSocketChannel.bind(UnixDomainSocketAddress)/SocketChannel.bind(UnixDomainSocketAddress) will have unknown user and group owner (win)
Reviewed-by: alanb
1 parent 677802d commit fb68395

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/java.base/windows/native/libnio/ch/UnixDomainSockets.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,16 @@ Java_sun_nio_ch_UnixDomainSockets_socketSupported(JNIEnv *env, jclass cl)
9292
return JNI_FALSE;
9393
}
9494
closesocket(s);
95-
return JNI_TRUE;
95+
96+
/* Check for build 18362 or newer, due to Windows bug described in 8259014 */
97+
98+
OSVERSIONINFOEXW osvi = { sizeof(osvi), 0, 0, 0, 0, {0}, 0, 0 };
99+
DWORDLONG cond_mask = 0;
100+
101+
VER_SET_CONDITION(cond_mask, VER_BUILDNUMBER, VER_GREATER_EQUAL);
102+
osvi.dwBuildNumber = 18362; // Windows 10 (1903) or newer
103+
104+
return VerifyVersionInfoW(&osvi, VER_BUILDNUMBER, cond_mask) != 0;
96105
}
97106

98107
JNIEXPORT jint JNICALL

0 commit comments

Comments
 (0)