From d5f502d940fb5a577fd9c55463ee675af44a3262 Mon Sep 17 00:00:00 2001 From: Scott Mitchell Date: Tue, 6 Oct 2015 19:00:59 -0700 Subject: [PATCH] Native getSoError bug Motivation: Java_io_netty_channel_epoll_Native_getSoError incorrectly returns the value from the get socket option function. Modifications: - return the value from the result of the get socket option call Result: Java_io_netty_channel_epoll_Native_getSoError returns the correct value. --- .../src/main/c/io_netty_channel_epoll_Native.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/transport-native-epoll/src/main/c/io_netty_channel_epoll_Native.c b/transport-native-epoll/src/main/c/io_netty_channel_epoll_Native.c index f5a2f2acad..c3a0e62553 100644 --- a/transport-native-epoll/src/main/c/io_netty_channel_epoll_Native.c +++ b/transport-native-epoll/src/main/c/io_netty_channel_epoll_Native.c @@ -1385,11 +1385,11 @@ JNIEXPORT jint JNICALL Java_io_netty_channel_epoll_Native_getSoLinger(JNIEnv* en } JNIEXPORT jint JNICALL Java_io_netty_channel_epoll_Native_getSoError(JNIEnv* env, jclass clazz, jint fd) { - int optval = 0; + int optval; if (getOption(env, fd, SOL_SOCKET, SO_ERROR, &optval, sizeof(optval)) == -1) { - return optval; + return -1; } - return 0; + return optval; } JNIEXPORT jint JNICALL Java_io_netty_channel_epoll_Native_getTrafficClass(JNIEnv* env, jclass clazz, jint fd) {