Apexd: Curb stat error spam
It is expected that the stat for isFlattenedApex will fail often,
namely every time the APEX is there but not flattened.
Test: m
Test: atest apexservice_test (manual inspection)
Change-Id: Icc387a6a0d9c320183c7d2941407916f4a6d049a
diff --git a/apexd/apex_file.cpp b/apexd/apex_file.cpp
index 447b037..633cbac 100644
--- a/apexd/apex_file.cpp
+++ b/apexd/apex_file.cpp
@@ -56,7 +56,12 @@
if (errno == ENOENT) {
return false;
}
- PLOG(ERROR) << "Failed to stat " << path << ". error: " << strerror(errno);
+ // If the APEX is there but not a flatttened apex, the final component
+ // of path will be a file, and stat will complain that it's not a directory.
+ // We are OK with that to avoid two stat calls.
+ if (errno != ENOTDIR) {
+ PLOG(ERROR) << "Failed to stat " << path;
+ }
return false;
}