src/java.base/unix/native/libnio/ch/InheritedChannel.c
branchunixdomainchannels
changeset 59003 aaba7cc40951
parent 58988 b88e23c84b23
child 59007 27709bf817a5
equal deleted inserted replaced
58988:b88e23c84b23 59003:aaba7cc40951
    70 {
    70 {
    71     SOCKETADDRESS sa;
    71     SOCKETADDRESS sa;
    72     socklen_t len = sizeof(SOCKETADDRESS);
    72     socklen_t len = sizeof(SOCKETADDRESS);
    73     jobject remote_sa = NULL;
    73     jobject remote_sa = NULL;
    74 
    74 
    75     if (sa.sa.sa_family == AF_UNIX) {
    75     if (getpeername(fd, &sa.sa, &len) == 0) {
    76     	remote_sa = NET_SockaddrToUnixAddress(env, &sa);
    76         if (sa.sa.sa_family == AF_UNIX) {
       
    77             remote_sa = NET_SockaddrToUnixAddress(env, &sa);
       
    78         }
    77     }
    79     }
    78     return remote_sa;
    80     return remote_sa;
    79 }
    81 }
    80 
    82 
    81 JNIEXPORT jint JNICALL
    83 JNIEXPORT jint JNICALL
    86     jint remote_port = -1;
    88     jint remote_port = -1;
    87 
    89 
    88     if (getpeername(fd, &sa.sa, &len) == 0) {
    90     if (getpeername(fd, &sa.sa, &len) == 0) {
    89         if (matchFamilyInet(&sa)) {
    91         if (matchFamilyInet(&sa)) {
    90             NET_SockaddrToInetAddress(env, &sa, (int *)&remote_port);
    92             NET_SockaddrToInetAddress(env, &sa, (int *)&remote_port);
    91 	}
    93         }
    92     }
    94     }
    93 
    95 
    94     return remote_port;
    96     return remote_port;
    95 }
    97 }
    96 
    98