From 567f1874fdd5765a6e20bc9f08b3264033267cb7 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Tue, 19 Mar 2019 14:38:48 -0700 Subject: [PATCH] init: expand prop in 'file' Allow having properties in 'file' option of a service. Test: boots (sanity) Test: lpdumpd Bug: 126233777 Change-Id: I55158b81e3829b393a9725fd8f09200690d0230f --- init/service.cpp | 5 +++++ 1 file changed, 5 insertions(+) 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 Service::ParseFile(std::vector&& 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"; }