Add error details when offline license is not found
[ Merge of http://go/wvgerrit/171310 ] Offline license not found errors are identified by CdmResponseEnum 347 (KEYSET_ID_NOT_FOUND_4). No addition file system information is shared. Checks for file existance use the stat command. The stat call can return error codes from errno.h when the command fails. These are now converted into sub error codes and returned along with the offline license file not found error. This also includes a change to log stat errors other than ENOENT (no such file or directory) as a warning rather than verbose. Bug: 276225520 Test: file_store_unittest, file_utils_unittest, GtsMediaTestCases Change-Id: Ic09d036549582cd65783b49fa96ffefc4bf562c7
This commit is contained in:
@@ -497,6 +497,11 @@ std::unique_ptr<File> FileSystem::Open(const std::string& file_name,
|
||||
return std::unique_ptr<File>(new AndroidFile(fd, flags, file_path));
|
||||
}
|
||||
|
||||
bool FileSystem::Exists(const std::string& path, int* errno_value) {
|
||||
return FileUtils::Exists(GetFileNameForIdentifier(path, identifier_),
|
||||
errno_value);
|
||||
}
|
||||
|
||||
bool FileSystem::Exists(const std::string& path) {
|
||||
return FileUtils::Exists(GetFileNameForIdentifier(path, identifier_));
|
||||
}
|
||||
|
||||
@@ -25,11 +25,22 @@ bool IsCurrentOrParentDirectory(const char* dir) {
|
||||
}
|
||||
|
||||
bool FileUtils::Exists(const std::string& path) {
|
||||
return Exists(path, nullptr);
|
||||
}
|
||||
|
||||
bool FileUtils::Exists(const std::string& path, int* errno_value) {
|
||||
struct stat buf;
|
||||
int error = 0;
|
||||
int res = stat(path.c_str(), &buf) == 0;
|
||||
if (!res) {
|
||||
LOGV("File::Exists: stat failed: %d, %s", errno, strerror(errno));
|
||||
error = errno;
|
||||
if (error == ENOENT) {
|
||||
LOGI("stat failed: ENOENT");
|
||||
} else {
|
||||
LOGE("stat failed: %d, %s", error, strerror(error));
|
||||
}
|
||||
}
|
||||
if (errno_value != nullptr) *errno_value = error;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user