am 59da4188: Remove corrupted license file from storage.

* commit '59da4188833cf281043a08deb788e59cca23b153':
  Remove corrupted license file from storage.
This commit is contained in:
Edwin Wong
2014-11-07 15:29:28 +00:00
committed by Android Git Automerger

View File

@@ -603,6 +603,9 @@ bool DeviceFiles::RetrieveFile(const char* name, std::string* serialized_file) {
ssize_t bytes = file_->FileSize(path);
if (bytes <= 0) {
LOGW("DeviceFiles::RetrieveFile: File size invalid: %s", path.c_str());
// Remove the corrupted file so the caller will not get the same error
// when trying to access the file repeatedly, causing the system to stall.
file_->Remove(path);
return false;
}
@@ -637,6 +640,9 @@ bool DeviceFiles::RetrieveFile(const char* name, std::string* serialized_file) {
if (hash.compare(hash_file.hash())) {
LOGW("DeviceFiles::RetrieveFile: Hash mismatch");
// Remove the corrupted file so the caller will not get the same error
// when trying to access the file repeatedly, causing the system to stall.
file_->Remove(path);
return false;
}