Bug 938683 - Catch and pass the error values of PR_Close() to upper layer. r=johns

This commit is contained in:
ISHIKAWA, Chiaki 2013-12-05 12:16:09 -05:00
parent 62ec275d0a
commit dd372c56b0

View File

@ -2321,7 +2321,14 @@ nsPluginHost::WritePluginInfo()
invalidPlugins = invalidPlugins->mNext;
}
PR_Close(fd);
PRStatus prrc;
prrc = PR_Close(fd);
if (prrc != PR_SUCCESS) {
// we should obtain a refined value based on prrc;
rv = NS_ERROR_FAILURE;
MOZ_ASSERT(false, "PR_Close() failed.");
return rv;
}
nsCOMPtr<nsIFile> parent;
rv = pluginReg->GetParent(getter_AddRefs(parent));
NS_ENSURE_SUCCESS(rv, rv);
@ -2398,7 +2405,15 @@ nsPluginHost::ReadPluginInfo()
rv = NS_ERROR_FAILURE;
int32_t bread = PR_Read(fd, registry, flen);
PR_Close(fd);
PRStatus prrc;
prrc = PR_Close(fd);
if (prrc != PR_SUCCESS) {
// Strange error: this is one of those "Should not happen" error.
// we may want to report something more refined than NS_ERROR_FAILURE.
MOZ_ASSERT(false, "PR_Close() failed.");
return rv;
}
if (flen > bread)
return rv;