summaryrefslogtreecommitdiffstats
path: root/init/subcontext.cpp
diff options
context:
space:
mode:
authorTom Cherry <tomcherry@google.com>2018-03-01 11:00:57 -0800
committerTom Cherry <tomcherry@google.com>2018-03-01 11:14:02 -0800
commit69d47aa829fa5a48baeadeff0e04d03e58f147b7 (patch)
tree1a0a12df0d8c8f9cd49cf418b65464dc90bab7bd /init/subcontext.cpp
parent45ee43b1acadc9635a547e41dcaf734f66678890 (diff)
downloadsystem_core-69d47aa829fa5a48baeadeff0e04d03e58f147b7.tar.gz
system_core-69d47aa829fa5a48baeadeff0e04d03e58f147b7.tar.bz2
system_core-69d47aa829fa5a48baeadeff0e04d03e58f147b7.zip
Clean up property set error handling
Currently we only report why a property set call has failed but drop the context of what was trying to set the property. This change adds information about why a property was trying to be set when it fails. It also unifies property_set() within init to go through the same HandlePropertySet() function as normal processes do, removing unneeded special cases. Test: boot bullhead Test: attempt to set invalid properties and see better error messages Change-Id: I5cd3a40086fd3b226e9c8a5e3a84cb3b31399c0d
Diffstat (limited to 'init/subcontext.cpp')
-rw-r--r--init/subcontext.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/init/subcontext.cpp b/init/subcontext.cpp
index faab36848..762492c87 100644
--- a/init/subcontext.cpp
+++ b/init/subcontext.cpp
@@ -297,7 +297,11 @@ Result<Success> Subcontext::Execute(const std::vector<std::string>& args) {
for (const auto& property : subcontext_reply->properties_to_set()) {
ucred cr = {.pid = pid_, .uid = 0, .gid = 0};
- HandlePropertySet(property.name(), property.value(), context_, cr);
+ std::string error;
+ if (HandlePropertySet(property.name(), property.value(), context_, cr, &error) != 0) {
+ LOG(ERROR) << "Subcontext init could not set '" << property.name() << "' to '"
+ << property.value() << "': " << error;
+ }
}
if (subcontext_reply->reply_case() == SubcontextReply::kFailure) {