read_port_etc():

* Also check whether the port is closed after waiting.
* Don't increment read_count after waiting failed. That should have been the
  cause of #5119.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34687 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2009-12-17 12:21:05 +00:00
parent c3bc71d6e2
commit 410ba11f8c

View File

@ -1175,7 +1175,8 @@ read_port_etc(port_id id, int32* _code, void* buffer, size_t bufferSize,
locker.Lock();
if (sPorts[slot].id != id) {
if (sPorts[slot].id != id
|| (is_port_closed(slot) && sPorts[slot].messages.IsEmpty())) {
// the port is no longer there
T(Read(sPorts[slot], 0, B_BAD_PORT_ID));
return B_BAD_PORT_ID;
@ -1183,7 +1184,6 @@ read_port_etc(port_id id, int32* _code, void* buffer, size_t bufferSize,
if (status != B_OK) {
T(Read(sPorts[slot], 0, status));
sPorts[slot].read_count++;
return status;
}
}