summaryrefslogtreecommitdiff
path: root/init/service_parser.cpp
diff options
context:
space:
mode:
authorTom Cherry <tomcherry@google.com>2019-08-01 22:04:30 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2019-08-01 22:04:30 +0000
commit549ea4801bca1be21cd4fe8e845e535e4f916130 (patch)
tree2217423420de009982eab86e6e00d03739b07248 /init/service_parser.cpp
parent1553cf829ab8599bbc72f7d77c0fbb6ab1ece45d (diff)
parent4772f1da47bfdad8e0b3e3cdbf1bdc6bda0443b1 (diff)
Merge changes Ied888249,Id8857c45
* changes: init: check the arguments of builtins during the build init: don't log in expand_props directly
Diffstat (limited to 'init/service_parser.cpp')
-rw-r--r--init/service_parser.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/init/service_parser.cpp b/init/service_parser.cpp
index 65d96c665..e45e80415 100644
--- a/init/service_parser.cpp
+++ b/init/service_parser.cpp
@@ -193,9 +193,9 @@ Result<void> ServiceParser::ParseIoprio(std::vector<std::string>&& args) {
Result<void> ServiceParser::ParseKeycodes(std::vector<std::string>&& args) {
auto it = args.begin() + 1;
if (args.size() == 2 && StartsWith(args[1], "$")) {
- std::string expanded;
- if (!expand_props(args[1], &expanded)) {
- return Error() << "Could not expand property '" << args[1] << "'";
+ auto expanded = ExpandProps(args[1]);
+ if (!expanded) {
+ return expanded.error();
}
// If the property is not set, it defaults to none, in which case there are no keycodes
@@ -204,7 +204,7 @@ Result<void> ServiceParser::ParseKeycodes(std::vector<std::string>&& args) {
return {};
}
- args = Split(expanded, ",");
+ args = Split(*expanded, ",");
it = args.begin();
}
@@ -422,9 +422,11 @@ Result<void> ServiceParser::ParseFile(std::vector<std::string>&& args) {
FileDescriptor file;
file.type = args[2];
- if (!expand_props(args[1], &file.name)) {
- return Error() << "Could not expand property in file path '" << args[1] << "'";
+ auto file_name = ExpandProps(args[1]);
+ if (!file_name) {
+ return Error() << "Could not expand file path ': " << file_name.error();
}
+ file.name = *file_name;
if (file.name[0] != '/' || file.name.find("../") != std::string::npos) {
return Error() << "file name must not be relative";
}