From 80c0774d8348376bf732db6d1adf36d40efcfb44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Kohlschu=CC=88tter?= Date: Fri, 28 Jun 2024 18:48:40 +0200 Subject: [PATCH] native: Fix socket timeout handling for blocking reads on Linux This was a bug introduced earlier in development of 2.10.0 --- junixsocket-native/src/main/c/receive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/junixsocket-native/src/main/c/receive.c b/junixsocket-native/src/main/c/receive.c index c5ff0d8c8..7185e83e8 100644 --- a/junixsocket-native/src/main/c/receive.c +++ b/junixsocket-native/src/main/c/receive.c @@ -276,7 +276,7 @@ JNIEXPORT jint JNICALL Java_org_newsclub_net_unix_NativeUnixSocket_read( jint returnValue; if(count < 0) { // read(2) returns -1 on error. Java throws an Exception. - if(errno == EWOULDBLOCK) { + if(errno == EWOULDBLOCK && checkNonBlocking(handle, socket_errno)) { returnValue = -2; } else { _throwErrnumException(env, errno, fd);