classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] FYI: javanet.c fix


From: Roman Kennke
Subject: [cp-patches] FYI: javanet.c fix
Date: Mon, 09 Jan 2006 21:30:21 +0000

Hi there,

in javanet.c we fiddle with the fd and localport fields in
java.net.SocketImpl. However, if we do DatagramSocket stuff, javanet.c
still tries to play with SocketImpl, although it should be
DatagramSocketImpl. Surprisingly, this often works, because the field
order is the same for both classes. However, if somebody has the idea to
change this, we will segfault. Also, in VMs that play with the field
order (like Jamaica), this can also segfault. To make things worse, Sun
decided to name the field localport -> localPort in DatagramSocketImpl.
This patch fixes all these problems by special casing stream vs datagram
sockets in javanet.c.

2006-01-09  Roman Kennke  <address@hidden>

        * native/jni/java-net/gnu_java_net_VMPlainSocketImpl.c
        (connect): Added stream parameter to _connect() call.
        * native/jni/java-net/gnu_java_net_VMPlainDatagramSocketImpl.c
        (connect): Added stream parameter to _connect() call.
        * native/jni/java-net/javanet.c
        (_javanet_create_localfd): Added stream parameter. Look up
        fd field based on the stream parameter either in SocketImpl or
        in DatagramSocketImpl.
        (_javanet_connect): Added stream parameter. Call create_localfd
        using this stream parameter. Set localPort field either in
        SocketImpl or in DatagramSocketImpl, depending on the stream
        flag.
        * native/jni/java-net/javanet.c
        (_javanet_connect): Added stream parameter.

/Roman

Attachment: patch.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]