diff options
author | Jooyung Han <jooyung@google.com> | 2020-06-12 02:56:13 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-06-12 02:56:13 +0000 |
commit | 7294acc88d1237a347480ffb62e2bdc49b83f10a (patch) | |
tree | 1e00514239beb80e012935f9aa48cf5d061bc87a /init/service_utils.cpp | |
parent | 52aa39beca7509482f2eb35336448d4afffc126f (diff) | |
parent | ef843ba6b947f24bd9b3bc009f0dffc3edcd9bac (diff) |
Merge "init: start ueventd in the default mount namespace" am: 7cc98e212b am: 9b07c52de0 am: 971add2022 am: 8ca831d2b1 am: ef843ba6b9
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1325695
Change-Id: I7acebca401f696aa83ffbf0e53ff9bbec08904cb
Diffstat (limited to 'init/service_utils.cpp')
-rw-r--r-- | init/service_utils.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/init/service_utils.cpp b/init/service_utils.cpp index 484c2c89f1..05e632b68c 100644 --- a/init/service_utils.cpp +++ b/init/service_utils.cpp @@ -194,7 +194,8 @@ Result<Descriptor> FileDescriptor::Create() const { return Descriptor(ANDROID_FILE_ENV_PREFIX + name, std::move(fd)); } -Result<void> EnterNamespaces(const NamespaceInfo& info, const std::string& name, bool pre_apexd) { +Result<void> EnterNamespaces(const NamespaceInfo& info, const std::string& name, + std::optional<MountNamespace> override_mount_namespace) { for (const auto& [nstype, path] : info.namespaces_to_enter) { if (auto result = EnterNamespace(nstype, path.c_str()); !result.ok()) { return result; @@ -202,9 +203,10 @@ Result<void> EnterNamespaces(const NamespaceInfo& info, const std::string& name, } #if defined(__ANDROID__) - if (pre_apexd) { - if (!SwitchToBootstrapMountNamespaceIfNeeded()) { - return Error() << "could not enter into the bootstrap mount namespace"; + if (override_mount_namespace.has_value()) { + if (auto result = SwitchToMountNamespaceIfNeeded(override_mount_namespace.value()); + !result.ok()) { + return result; } } #endif |