Avoid repeated logging of the file name when ReadConfig returns an
error.
https://r.android.com/2963904 made ReadConfig include the file name in
the error if the file cannot be read, but some call sites added it as
well. Make it consistently the responsibility of ReadConfig.
Also shorten an error message where the path itself is good enough to
identify the call site.
Test: presubmits
Bug: 325107109
Change-Id: I0c7d6c0ea3a7fb5d2ba1fa6aa25557080ac4d630
diff --git a/libnativeloader/public_libraries.cpp b/libnativeloader/public_libraries.cpp
index af965a0..390c298 100644
--- a/libnativeloader/public_libraries.cpp
+++ b/libnativeloader/public_libraries.cpp
@@ -139,8 +139,8 @@
if (ret.ok()) {
sonames->insert(sonames->end(), ret->begin(), ret->end());
} else {
- LOG_ALWAYS_FATAL("Error reading public native library list from \"%s\": %s",
- config_file_path.c_str(), ret.error().message().c_str());
+ LOG_ALWAYS_FATAL("Error reading extension library list: %s",
+ ret.error().message().c_str());
}
}
}
@@ -158,8 +158,7 @@
}
});
if (!sonames.ok()) {
- LOG_ALWAYS_FATAL("Error reading public native library list from \"%s\": %s",
- config_file.c_str(), sonames.error().message().c_str());
+ LOG_ALWAYS_FATAL("%s", sonames.error().message().c_str());
return "";
}
@@ -252,7 +251,7 @@
}
Result<std::vector<std::string>> sonames = ReadConfig(config_file, always_true);
if (!sonames.ok()) {
- LOG_ALWAYS_FATAL("%s: %s", config_file.c_str(), sonames.error().message().c_str());
+ LOG_ALWAYS_FATAL("%s", sonames.error().message().c_str());
return "";
}
std::string libs = android::base::Join(*sonames, ':');
@@ -274,7 +273,7 @@
}
Result<std::vector<std::string>> sonames = ReadConfig(config_file, always_true);
if (!sonames.ok()) {
- LOG_ALWAYS_FATAL("%s: %s", config_file.c_str(), sonames.error().message().c_str());
+ LOG_ALWAYS_FATAL("%s", sonames.error().message().c_str());
return "";
}
std::string libs = android::base::Join(*sonames, ':');