summaryrefslogtreecommitdiffstats
path: root/updater/install.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2018-07-10 00:08:50 +0200
committerTao Bao <tbao@google.com>2018-07-10 19:38:47 +0200
commitbafd6c7afb134b78673b4d8ff680082cb3d5a805 (patch)
treef2780106455f5bc6c318f8949b81aa480bfdf47d /updater/install.cpp
parentMerge "edify: Rename parse_string to ParseString and let it take std::string." (diff)
downloadandroid_bootable_recovery-bafd6c7afb134b78673b4d8ff680082cb3d5a805.tar
android_bootable_recovery-bafd6c7afb134b78673b4d8ff680082cb3d5a805.tar.gz
android_bootable_recovery-bafd6c7afb134b78673b4d8ff680082cb3d5a805.tar.bz2
android_bootable_recovery-bafd6c7afb134b78673b4d8ff680082cb3d5a805.tar.lz
android_bootable_recovery-bafd6c7afb134b78673b4d8ff680082cb3d5a805.tar.xz
android_bootable_recovery-bafd6c7afb134b78673b4d8ff680082cb3d5a805.tar.zst
android_bootable_recovery-bafd6c7afb134b78673b4d8ff680082cb3d5a805.zip
Diffstat (limited to 'updater/install.cpp')
-rw-r--r--updater/install.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/updater/install.cpp b/updater/install.cpp
index 02a6fe7c5..d0be955a7 100644
--- a/updater/install.cpp
+++ b/updater/install.cpp
@@ -742,7 +742,7 @@ Value* RunProgramFn(const char* name, State* state, const std::vector<std::uniqu
}
// read_file(filename)
-// Reads a local file 'filename' and returns its contents as a Value string.
+// Reads a local file 'filename' and returns its contents as a string Value.
Value* ReadFileFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) {
if (argv.size() != 1) {
return ErrorAbort(state, kArgsParsingFailure, "%s() expects 1 arg, got %zu", name, argv.size());
@@ -754,13 +754,13 @@ Value* ReadFileFn(const char* name, State* state, const std::vector<std::unique_
}
const std::string& filename = args[0];
- FileContents fc;
- if (LoadFileContents(filename.c_str(), &fc) == 0) {
- return new Value(Value::Type::BLOB, std::string(fc.data.cbegin(), fc.data.cend()));
+ std::string contents;
+ if (android::base::ReadFileToString(filename, &contents)) {
+ return new Value(Value::Type::STRING, std::move(contents));
}
// Leave it to caller to handle the failure.
- LOG(ERROR) << name << ": Failed to read " << filename;
+ PLOG(ERROR) << name << ": Failed to read " << filename;
return StringValue("");
}