summaryrefslogtreecommitdiffstats
path: root/init/service.cpp
diff options
context:
space:
mode:
authorYifan Hong <elsk@google.com>2019-03-19 14:38:48 -0700
committerYifan Hong <elsk@google.com>2019-03-21 16:00:00 -0700
commit567f1874fdd5765a6e20bc9f08b3264033267cb7 (patch)
treee4cadab3164da028a73acd71828c17c91320f3d2 /init/service.cpp
parentdd6eefca303755264434454fddc0cc627e834577 (diff)
downloadsystem_core-567f1874fdd5765a6e20bc9f08b3264033267cb7.tar.gz
system_core-567f1874fdd5765a6e20bc9f08b3264033267cb7.tar.bz2
system_core-567f1874fdd5765a6e20bc9f08b3264033267cb7.zip
init: expand prop in 'file'
Allow having properties in 'file' option of a service. Test: boots (sanity) Test: lpdumpd Bug: 126233777 Change-Id: I55158b81e3829b393a9725fd8f09200690d0230f
Diffstat (limited to 'init/service.cpp')
-rw-r--r--init/service.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/init/service.cpp b/init/service.cpp
index cba42c4fd..6d08cb14a 100644
--- a/init/service.cpp
+++ b/init/service.cpp
@@ -756,6 +756,11 @@ Result<Success> Service::ParseFile(std::vector<std::string>&& args) {
if (args[2] != "r" && args[2] != "w" && args[2] != "rw") {
return Error() << "file type must be 'r', 'w' or 'rw'";
}
+ std::string expanded;
+ if (!expand_props(args[1], &expanded)) {
+ return Error() << "Could not expand property in file path '" << args[1] << "'";
+ }
+ args[1] = std::move(expanded);
if ((args[1][0] != '/') || (args[1].find("../") != std::string::npos)) {
return Error() << "file name must not be relative";
}