Ignore EINTR on close(...) as there is nothing sane we can do.

Motivation:

If close(...) reports EINTR there is nothing sane we can do so it makes no sense to even report it. See also:

https://github.com/apple/swift-nio/pull/217

Modifications:

Just ignore EINTR when calling close(...)

Result:

Less noise in the logs.
This commit is contained in:
Norman Maurer 2018-03-22 14:03:46 +01:00 committed by Norman Maurer
parent 40af10b782
commit 8189399e9d

View File

@ -79,8 +79,16 @@ static jint _read(JNIEnv* env, jclass clazz, jint fd, void* buffer, jint pos, ji
// JNI Registered Methods Begin // JNI Registered Methods Begin
static jint netty_unix_filedescriptor_close(JNIEnv* env, jclass clazz, jint fd) { static jint netty_unix_filedescriptor_close(JNIEnv* env, jclass clazz, jint fd) {
if (close(fd) < 0) { if (close(fd) < 0) {
// There is really nothing "sane" we can do when EINTR was reported on close. So just ignore it and "assume"
// everything is fine == we closed the file descriptor.
//
// For more details see:
// - https://bugs.chromium.org/p/chromium/issues/detail?id=269623
// - https://lwn.net/Articles/576478/
if (errno != EINTR) {
return -errno; return -errno;
} }
}
return 0; return 0;
} }