summaryrefslogtreecommitdiff
path: root/init/builtins.cpp
diff options
context:
space:
mode:
authorJorge Lucangeli Obes <jorgelo@google.com>2016-12-28 14:07:02 -0500
committerJorge Lucangeli Obes <jorgelo@google.com>2016-12-28 14:16:54 -0500
commit77f0e9fda8839a21a4d360f128fe9af820b8819c (patch)
tree2700a76901856fedfb1a6254dc319e365b9c6aff /init/builtins.cpp
parent491c3871a08b32b43b6f202eb6ca5a7dd6b7cafd (diff)
init: Make 'write_file' return bool to match 'read_file'.
The mismatch of return values makes reasoning about the correctness of CLs like https://android-review.googlesource.com/317923 quite hard. Bug: 33941660 Test: Init builds, HiKey boots. Change-Id: Ia4b8a9af420682997b154a594892740181980921
Diffstat (limited to 'init/builtins.cpp')
-rw-r--r--init/builtins.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp
index 8059166c7..1186e9db9 100644
--- a/init/builtins.cpp
+++ b/init/builtins.cpp
@@ -249,7 +249,7 @@ static int do_class_reset(const std::vector<std::string>& args) {
}
static int do_domainname(const std::vector<std::string>& args) {
- return write_file("/proc/sys/kernel/domainname", args[1].c_str());
+ return write_file("/proc/sys/kernel/domainname", args[1].c_str()) ? 0 : 1;
}
static int do_enable(const std::vector<std::string>& args) {
@@ -277,7 +277,7 @@ static int do_export(const std::vector<std::string>& args) {
}
static int do_hostname(const std::vector<std::string>& args) {
- return write_file("/proc/sys/kernel/hostname", args[1].c_str());
+ return write_file("/proc/sys/kernel/hostname", args[1].c_str()) ? 0 : 1;
}
static int do_ifup(const std::vector<std::string>& args) {
@@ -814,7 +814,7 @@ static int do_verity_update_state(const std::vector<std::string>& args) {
static int do_write(const std::vector<std::string>& args) {
const char* path = args[1].c_str();
const char* value = args[2].c_str();
- return write_file(path, value);
+ return write_file(path, value) ? 0 : 1;
}
static int do_copy(const std::vector<std::string>& args) {