0
0
Fork 0
haikuports/dev-lang/openjdk/patches/openjdk14-14.0.2.12.patchset

42 lines
1.7 KiB
Plaintext

From 8a856dc15c1825289fadf3d1086d6cc5cd7159af Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Thu, 29 Oct 2020 14:07:26 +0100
Subject: Haiku: workaround for NetworkInterface ioctl calls
ATM the Haiku network stack checks for ioctl syscall length parameter.
diff --git a/src/java.base/unix/native/libnet/NetworkInterface.c b/src/java.base/unix/native/libnet/NetworkInterface.c
index 653576d..6f03884 100644
--- a/src/java.base/unix/native/libnet/NetworkInterface.c
+++ b/src/java.base/unix/native/libnet/NetworkInterface.c
@@ -2303,7 +2303,7 @@ static int getIndex(int sock, const char *name) {
memset((char *)&if2, 0, sizeof(if2));
strncpy(if2.ifr_name, name, sizeof(if2.ifr_name) - 1);
- if (ioctl(sock, SIOCGIFINDEX, (char *)&if2) < 0) {
+ if (ioctl(sock, SIOCGIFINDEX, (char *)&if2, sizeof(if2)) < 0) {
return -1;
}
@@ -2351,7 +2351,7 @@ static int getMTU(JNIEnv *env, int sock, const char *ifname) {
memset((char *)&if2, 0, sizeof(if2));
strncpy(if2.ifr_name, ifname, sizeof(if2.ifr_name) - 1);
- if (ioctl(sock, SIOCGIFMTU, (char *)&if2) < 0) {
+ if (ioctl(sock, SIOCGIFMTU, (char *)&if2, sizeof(if2)) < 0) {
NET_ThrowByNameWithLastError
(env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGIFMTU) failed");
return -1;
@@ -2365,7 +2365,7 @@ static int getFlags(int sock, const char *ifname, int *flags) {
memset((char *)&if2, 0, sizeof(if2));
strncpy(if2.ifr_name, ifname, sizeof(if2.ifr_name) - 1);
- if (ioctl(sock, SIOCGIFFLAGS, (char *)&if2) < 0) {
+ if (ioctl(sock, SIOCGIFFLAGS, (char *)&if2, sizeof(if2)) < 0) {
return -1;
}
--
2.28.0