diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2019-03-19 06:17:27 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2019-03-19 06:17:27 +0000 |
commit | ecaa73e0e879e7abd0b312f9e3e993e649de41bf (patch) | |
tree | 98d8c7c7ca5d87591feabccd31eb7855453ef43b | |
parent | 3fd4d58c3b9d81af81e34173e3e63e4bd9ca37b8 (diff) | |
parent | 8196b8c937a7ea2beb112c365b1ffd26e6ac50e0 (diff) | |
download | security-ecaa73e0e879e7abd0b312f9e3e993e649de41bf.tar.gz |
Snap for 5386257 from 8196b8c937a7ea2beb112c365b1ffd26e6ac50e0 to qt-release
Change-Id: I7da7517e20366d692aacc19e95525e161932e628
-rw-r--r-- | keystore/blob.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/keystore/blob.cpp b/keystore/blob.cpp index 9dd85d62..eac8f11d 100644 --- a/keystore/blob.cpp +++ b/keystore/blob.cpp @@ -676,10 +676,27 @@ std::string KeyBlobEntry::getCharacteristicsBlobPath() const { } 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) { |