Skip to content

Commit ed14244

Browse files
inatatsunormanmaurer
authored andcommitted
Enable Netty on a big endian platform
Motivation: We would like to enable Netty also on a big endian platform such as s390_64. We need to fix a function which assumes that the target platform is little endian. Modifications: Modify netty_unix_socket_accept() to write an address length as jbyte instead of jsize. Result: Netty can be enabled on a big endian platform. Signed-off-by: Tatsushi Inagaki <[email protected]>
1 parent b39ffed commit ed14244

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

transport-native-unix-common/src/main/c/netty_unix_socket.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,7 @@ static jint netty_unix_socket_disconnect(JNIEnv* env, jclass clazz, jint fd, jbo
540540
static jint netty_unix_socket_accept(JNIEnv* env, jclass clazz, jint fd, jbyteArray acceptedAddress) {
541541
jint socketFd;
542542
jsize len;
543+
jbyte len_b;
543544
int err;
544545
struct sockaddr_storage addr;
545546
socklen_t address_len = sizeof(addr);
@@ -564,9 +565,10 @@ static jint netty_unix_socket_accept(JNIEnv* env, jclass clazz, jint fd, jbyteAr
564565
}
565566

566567
len = addressLength(&addr);
568+
len_b = (jbyte) len;
567569

568570
// Fill in remote address details
569-
(*env)->SetByteArrayRegion(env, acceptedAddress, 0, 4, (jbyte*) &len);
571+
(*env)->SetByteArrayRegion(env, acceptedAddress, 0, 1, (jbyte*) &len_b);
570572
initInetSocketAddressArray(env, &addr, acceptedAddress, 1, len);
571573

572574
if (accept4) {

0 commit comments

Comments
 (0)