From f326f69e5725baa9a10ea750fc689eea596667a8 Mon Sep 17 00:00:00 2001 From: Greg Lewis Date: Fri, 8 Jul 2011 07:28:46 +0000 Subject: . Try harder to make sure the flags returned from getFlags isn't negative, since a number of places in the code check for that and assume that it means an error occurred. On FreeBSD, in particular, the value of ifr_flags can be negative if multicast is enabled on the socket since the possible flags have expanded to fill more than a short. Instead of blindly promoting ifr_flags to an int, which will preserve the sign, we fill the int return value with ifr_flagshigh in the high 16 bits and ifr_flags in the low 16 bits. PR: 155186 Reported by: Alex Hayward --- ...patch-src-solaris-native-java-net-NetworkInterface.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 java/openjdk7/files/patch-src-solaris-native-java-net-NetworkInterface.c (limited to 'java/openjdk7/files/patch-src-solaris-native-java-net-NetworkInterface.c') diff --git a/java/openjdk7/files/patch-src-solaris-native-java-net-NetworkInterface.c b/java/openjdk7/files/patch-src-solaris-native-java-net-NetworkInterface.c new file mode 100644 index 000000000000..8a977e6d87d7 --- /dev/null +++ b/java/openjdk7/files/patch-src-solaris-native-java-net-NetworkInterface.c @@ -0,0 +1,17 @@ +$FreeBSD$ + +--- jdk/src/solaris/native/java/net/NetworkInterface.c Mon Jun 27 22:08:16 2011 -0700 ++++ jdk/src/solaris/native/java/net/NetworkInterface.c Thu Jul 07 23:37:05 2011 -0700 +@@ -1968,7 +1968,11 @@ + return -1; + } + +- return if2.ifr_flags; ++#ifdef __FreeBSD__ ++ return ((if2.ifr_flags & 0xffff) | (if2.ifr_flagshigh << 16)); ++#else ++ return (((int) if2.ifr_flags) & 0xffff); ++#endif + } + + #endif -- cgit v1.2.3