Bug 1333384 - nsTemporaryFileInputStream::ReadSegments must consider the stream as closed if PR_Read() return 0, r=bkelly

This commit is contained in:
Andrea Marchesini 2017-01-24 16:02:15 +01:00
parent 26f2c60483
commit 5e4160791e

View File

@ -84,6 +84,11 @@ nsTemporaryFileInputStream::ReadSegments(nsWriteSegmentFun writer,
while (*result < count) {
uint32_t bufCount = std::min(count - *result, (uint32_t) sizeof(buf));
int32_t bytesRead = PR_Read(mFileDescOwner->mFD, buf, bufCount);
if (bytesRead == 0) {
mClosed = true;
return NS_OK;
}
if (bytesRead < 0) {
return NS_ErrorAccordingToNSPR();
}