check_vintf: Clear error message when we are ignoring it.
In the case of NAME_NOT_FOUND, we generally pretend that no error
happen, so in addition of pretending that listFiles() returned OK, we
also need to clear the error message, or it would be leaked into verdict
message about why files are incompatible, which can be confusing for
developers.
Bug: 197001420
Fixed: 197001420
Change-Id: I3f9c536711d953e66420d0d2877481c5e28e9a37
diff --git a/VintfObject.cpp b/VintfObject.cpp
index 394350e..7b7d8e2 100644
--- a/VintfObject.cpp
+++ b/VintfObject.cpp
@@ -220,7 +220,12 @@
std::vector<std::string> fileNames;
status_t err = getFileSystem()->listFiles(directory, &fileNames, error);
// if the directory isn't there, that's okay
- if (err == NAME_NOT_FOUND) return OK;
+ if (err == NAME_NOT_FOUND) {
+ if (error) {
+ error->clear();
+ }
+ return OK;
+ }
if (err != OK) return err;
for (const std::string& file : fileNames) {
@@ -496,6 +501,9 @@
std::vector<std::string> fileNames;
status_t listStatus = getFileSystem()->listFiles(dir, &fileNames, error);
if (listStatus == NAME_NOT_FOUND) {
+ if (error) {
+ error->clear();
+ }
continue;
}
if (listStatus != OK) {