diff options
author | Steven Laver <lavers@google.com> | 2019-12-12 15:29:36 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-12-12 15:29:36 +0000 |
commit | a239544c7b06814b70fd970de7eaac234682fa52 (patch) | |
tree | a4298d61f9b73642f350799b1157e49b65f4e1e8 /init/subcontext.cpp | |
parent | 63de1e1c8d7824c241f22de67edf54f4f1eaeea5 (diff) | |
parent | 5319412e5305a3b4bcecf251a2955c09a6e9837e (diff) |
Merge "Merge RP1A.191203.001" into r-keystone-qcom-dev
Diffstat (limited to 'init/subcontext.cpp')
-rw-r--r-- | init/subcontext.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/init/subcontext.cpp b/init/subcontext.cpp index e55265b0a..bebcc7733 100644 --- a/init/subcontext.cpp +++ b/init/subcontext.cpp @@ -209,8 +209,12 @@ void Subcontext::Fork() { PLOG(FATAL) << "Could not dup child_fd"; } - if (setexeccon(context_.c_str()) < 0) { - PLOG(FATAL) << "Could not set execcon for '" << context_ << "'"; + // We don't switch contexts if we're running the unit tests. We don't use std::optional, + // since we still need a real context string to pass to the builtin functions. + if (context_ != kTestContext) { + if (setexeccon(context_.c_str()) < 0) { + PLOG(FATAL) << "Could not set execcon for '" << context_ << "'"; + } } auto init_path = GetExecutablePath(); |