init: do not log directly from read_file() and write_file()
Their callers may be able to add more context, so use an error string
to record the error.
Bug: 38038887
Test: boot bullhead
Test: Init unit tests
Change-Id: I46690d1c66e00a4b15cadc6fd0d6b50e990388c3
diff --git a/init/property_service.cpp b/init/property_service.cpp
index 6f40d1c..e01cd0b 100644
--- a/init/property_service.cpp
+++ b/init/property_service.cpp
@@ -510,8 +510,9 @@
static void load_properties_from_file(const char* filename, const char* filter) {
Timer t;
std::string data;
- if (!read_file(filename, &data)) {
- PLOG(WARNING) << "Couldn't load properties from " << filename;
+ std::string err;
+ if (!ReadFile(filename, &data, &err)) {
+ PLOG(WARNING) << "Couldn't load property file: " << err;
return;
}
data.push_back('\n');