Merge "Clearly indicate vendor errors from keymaster in logcat"
diff --git a/keystore/blob.cpp b/keystore/blob.cpp
index 9dd85d6..eac8f11 100644
--- a/keystore/blob.cpp
+++ b/keystore/blob.cpp
@@ -676,10 +676,27 @@
}
bool KeyBlobEntry::hasKeyBlob() const {
- return !access(getKeyBlobPath().c_str(), R_OK | W_OK);
+ int trys = 3;
+ while (trys--) {
+ if (!access(getKeyBlobPath().c_str(), R_OK | W_OK)) return true;
+ if (errno == ENOENT) return false;
+ LOG(WARNING) << "access encountered " << strerror(errno) << " (" << errno << ")"
+ << " while checking for key blob";
+ if (errno != EAGAIN) break;
+ }
+ return false;
}
+
bool KeyBlobEntry::hasCharacteristicsBlob() const {
- return !access(getCharacteristicsBlobPath().c_str(), R_OK | W_OK);
+ int trys = 3;
+ while (trys--) {
+ if (!access(getCharacteristicsBlobPath().c_str(), R_OK | W_OK)) return true;
+ if (errno == ENOENT) return false;
+ LOG(WARNING) << "access encountered " << strerror(errno) << " (" << errno << ")"
+ << " while checking for key characteristics blob";
+ if (errno != EAGAIN) break;
+ }
+ return false;
}
static std::tuple<bool, uid_t, std::string> filename2UidAlias(const std::string& filepath) {