From 48f1a5b4c933ab0e872328276cd0795cff596d49 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sun, 24 May 2009 22:13:12 +0000 Subject: [PATCH] Patch by Eric Petit: A read select() should not block when there's not data available anymore and the remote end has been write-shut-down. Fixes #3536. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30846 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/network/protocols/unix/UnixEndpoint.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/add-ons/kernel/network/protocols/unix/UnixEndpoint.cpp b/src/add-ons/kernel/network/protocols/unix/UnixEndpoint.cpp index 130c198826..4b6410aefb 100644 --- a/src/add-ons/kernel/network/protocols/unix/UnixEndpoint.cpp +++ b/src/add-ons/kernel/network/protocols/unix/UnixEndpoint.cpp @@ -633,7 +633,10 @@ UnixEndpoint::Receivable() RETURN_ERROR(ENOTCONN); UnixFifoLocker fifoLocker(fReceiveFifo); - RETURN_ERROR(fReceiveFifo->Readable()); + ssize_t readable = fReceiveFifo->Readable(); + if (readable == 0 && fReceiveFifo->IsWriteShutdown()) + RETURN_ERROR(ENOTCONN); + RETURN_ERROR(readable); }