diff options
author | Steven Moreland | 2017-11-10 16:43:58 -0600 |
---|---|---|
committer | Steven Moreland | 2017-11-15 12:39:29 -0600 |
commit | 5e1bea30b924661878c6fac4ec14b18e5ba17773 (patch) | |
tree | b46478a42b8a95e58c221d828b8dd4afdd0119a2 | |
parent | 7d0a5c3656ee56eb81e442b58063d500b4f506e0 (diff) | |
download | platform-system-core-5e1bea30b924661878c6fac4ec14b18e5ba17773.tar.gz platform-system-core-5e1bea30b924661878c6fac4ec14b18e5ba17773.tar.xz platform-system-core-5e1bea30b924661878c6fac4ec14b18e5ba17773.zip |
Move service name duplication lookup to EndSection
This is paving the way to allow an "override" tag
in init services. This also means that errors for
part of a service definition in its section will
be shown in addition to the fact that the service
is duplicated.
Bug: 69050941
Test: boot, init_tests
Change-Id: Ic1ea8597789f45ead1083451b3e933db1524bdc9
-rw-r--r-- | init/service.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/init/service.cpp b/init/service.cpp index 6d48368e0..65f5f504c 100644 --- a/init/service.cpp +++ b/init/service.cpp | |||
@@ -1111,11 +1111,6 @@ Result<Success> ServiceParser::ParseSection(std::vector<std::string>&& args, | |||
1111 | return Error() << "invalid service name '" << name << "'"; | 1111 | return Error() << "invalid service name '" << name << "'"; |
1112 | } | 1112 | } |
1113 | 1113 | ||
1114 | Service* old_service = service_list_->FindService(name); | ||
1115 | if (old_service) { | ||
1116 | return Error() << "ignored duplicate definition of service '" << name << "'"; | ||
1117 | } | ||
1118 | |||
1119 | Subcontext* restart_action_subcontext = nullptr; | 1114 | Subcontext* restart_action_subcontext = nullptr; |
1120 | if (subcontexts_) { | 1115 | if (subcontexts_) { |
1121 | for (auto& subcontext : *subcontexts_) { | 1116 | for (auto& subcontext : *subcontexts_) { |
@@ -1137,6 +1132,11 @@ Result<Success> ServiceParser::ParseLineSection(std::vector<std::string>&& args, | |||
1137 | 1132 | ||
1138 | Result<Success> ServiceParser::EndSection() { | 1133 | Result<Success> ServiceParser::EndSection() { |
1139 | if (service_) { | 1134 | if (service_) { |
1135 | Service* old_service = service_list_->FindService(service_->name()); | ||
1136 | if (old_service) { | ||
1137 | return Error() << "ignored duplicate definition of service '" << service_->name() << "'"; | ||
1138 | } | ||
1139 | |||
1140 | service_list_->AddService(std::move(service_)); | 1140 | service_list_->AddService(std::move(service_)); |
1141 | } | 1141 | } |
1142 | 1142 | ||