From 2cbbe9f7a35efdc94e8e34ef92eb6f70a85887fe Mon Sep 17 00:00:00 2001 From: Tom Cherry Date: Thu, 4 May 2017 18:17:33 -0700 Subject: 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 --- init/init_test.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'init/init_test.cpp') diff --git a/init/init_test.cpp b/init/init_test.cpp index 3da14b5ab..7093ba980 100644 --- a/init/init_test.cpp +++ b/init/init_test.cpp @@ -152,10 +152,11 @@ TEST(init, EventTriggerOrderMultipleFiles) { "on boot\n" "execute 3"; // clang-format on - // write_file() ensures the right mode is set - ASSERT_TRUE(write_file(std::string(dir.path) + "/a.rc", dir_a_script)); + // WriteFile() ensures the right mode is set + std::string err; + ASSERT_TRUE(WriteFile(std::string(dir.path) + "/a.rc", dir_a_script, &err)); - ASSERT_TRUE(write_file(std::string(dir.path) + "/b.rc", "on boot\nexecute 5")); + ASSERT_TRUE(WriteFile(std::string(dir.path) + "/b.rc", "on boot\nexecute 5", &err)); // clang-format off std::string start_script = "import " + std::string(first_import.path) + "\n" -- cgit v1.2.3