summaryrefslogtreecommitdiff
path: root/init/builtins.cpp
diff options
context:
space:
mode:
authorTom Cherry <tomcherry@google.com>2017-08-22 15:41:03 -0700
committerTom Cherry <tomcherry@google.com>2017-08-23 10:09:21 -0700
commit6de21f11125941ea1b94fdeec754bacea3916fd5 (patch)
treec230a45f1202300f86ff3551e852612a3519ad73 /init/builtins.cpp
parent7f16cad877571ce8ef0808dcdb81234d61b771ca (diff)
init: cleanup environment handling
Init keep its own copy of the environment that it uses for execve when starting services. This is unnecessary however as libc already has functions that mutate the environment and the environment that init uses is clean for starting services. This change removes init's copy of the environment and uses the libc functions instead. This also makes small clean-up to the way the Service class stores service specific environment variables. Test: boot bullhead Change-Id: I7c98a0b7aac9fa8f195ae33bd6a7515bb56faf78
Diffstat (limited to 'init/builtins.cpp')
-rw-r--r--init/builtins.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp
index f807343ab..593f718f1 100644
--- a/init/builtins.cpp
+++ b/init/builtins.cpp
@@ -159,8 +159,8 @@ static Result<Success> do_exec_start(const std::vector<std::string>& args) {
}
static Result<Success> do_export(const std::vector<std::string>& args) {
- if (!add_environment(args[1].c_str(), args[2].c_str())) {
- return Error();
+ if (setenv(args[1].c_str(), args[2].c_str(), 1) == -1) {
+ return ErrnoError() << "setenv() failed";
}
return Success();
}