AdapterIO: Size could be 0
* Also avoid seeking completely when we are sure we have to block.
This commit is contained in:
@@ -61,6 +61,8 @@ public:
|
|||||||
// block on that.
|
// block on that.
|
||||||
if (IsMutable())
|
if (IsMutable())
|
||||||
return B_WOULD_BLOCK;
|
return B_WOULD_BLOCK;
|
||||||
|
else if (size == 0)
|
||||||
|
return B_RESOURCE_UNAVAILABLE;
|
||||||
else
|
else
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
@@ -319,6 +321,7 @@ BAdapterIO::_EvaluateWait(off_t pos)
|
|||||||
|
|
||||||
status_t err = fBuffer->EvaluatePosition(pos);
|
status_t err = fBuffer->EvaluatePosition(pos);
|
||||||
|
|
||||||
|
if (err != B_WOULD_BLOCK) {
|
||||||
if (err != B_RESOURCE_UNAVAILABLE && err != B_OK)
|
if (err != B_RESOURCE_UNAVAILABLE && err != B_OK)
|
||||||
return B_UNSUPPORTED;
|
return B_UNSUPPORTED;
|
||||||
|
|
||||||
@@ -327,6 +330,7 @@ BAdapterIO::_EvaluateWait(off_t pos)
|
|||||||
if (SeekRequested(pos) != B_OK)
|
if (SeekRequested(pos) != B_OK)
|
||||||
return B_UNSUPPORTED;
|
return B_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return fBuffer->WaitForData(pos);
|
return fBuffer->WaitForData(pos);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user