Build error with GCC 10 in NetworkInterface.c and k_standard.c
Daniel Fuchs
daniel.fuchs at oracle.com
Tue Jul 14 18:36:25 UTC 2020
Hi Koichi,
On 13/07/2020 08:03, Koichi Sakata wrote:
> I understand that. I respect your idea.
> I fixed the patch as follows.
The changes to NetworkInterface.c look good to me.
>
> By the way, k_standard.c still remains. Is there a way to proceed
with it?
You'll need to find a reviewer that understands what that
method is supposed to do in that case, that's not me ;-)
best regards,
-- daniel
> Thanks, > Koichi
>
> ===== PATCH =====
> diff --git a/src/java.base/unix/native/libnet/NetworkInterface.c
> b/src/java.base/unix/native/libnet/NetworkInterface.c
> --- a/src/java.base/unix/native/libnet/NetworkInterface.c
> +++ b/src/java.base/unix/native/libnet/NetworkInterface.c
> @@ -1296,7 +1296,8 @@
> static int getIndex(int sock, const char *name) {
> struct ifreq if2;
> memset((char *)&if2, 0, sizeof(if2));
> - strncpy(if2.ifr_name, name, sizeof(if2.ifr_name) - 1);
> + strncpy(if2.ifr_name, name, sizeof(if2.ifr_name));
> + if2.ifr_name[sizeof(if2.ifr_name) - 1] = 0;
>
> if (ioctl(sock, SIOCGIFINDEX, (char *)&if2) < 0) {
> return -1;
> @@ -1359,7 +1360,8 @@
> static int getFlags(int sock, const char *ifname, int *flags) {
> struct ifreq if2;
> memset((char *)&if2, 0, sizeof(if2));
> - strncpy(if2.ifr_name, ifname, sizeof(if2.ifr_name) - 1);
> + strncpy(if2.ifr_name, ifname, sizeof(if2.ifr_name));
> + if2.ifr_name[sizeof(if2.ifr_name) - 1] = 0;
>
> if (ioctl(sock, SIOCGIFFLAGS, (char *)&if2) < 0) {
> return -1;
> diff --git a/src/java.base/share/native/libfdlibm/k_standard.c
> b/src/java.base/share/native/libfdlibm/k_standard.c
> --- a/src/java.base/share/native/libfdlibm/k_standard.c
> +++ b/src/java.base/share/native/libfdlibm/k_standard.c
> @@ -739,6 +739,10 @@
> errno = EDOM;
> }
> break;
> + default:
> + exc.retval = zero;
> + errno = EINVAL;
> + break;
> }
> return exc.retval;
> }
>
>
More information about the core-libs-dev
mailing list