init: expand prop in 'file'
Allow having properties in 'file' option of a service. Test: boots (sanity) Test: lpdumpd Bug: 126233777 Change-Id: I55158b81e3829b393a9725fd8f09200690d0230f
This commit is contained in:
parent
dd6eefca30
commit
567f1874fd
1 changed files with 5 additions and 0 deletions
|
|
@ -756,6 +756,11 @@ Result<Success> Service::ParseFile(std::vector<std::string>&& args) {
|
||||||
if (args[2] != "r" && args[2] != "w" && args[2] != "rw") {
|
if (args[2] != "r" && args[2] != "w" && args[2] != "rw") {
|
||||||
return Error() << "file type must be 'r', 'w' or '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)) {
|
if ((args[1][0] != '/') || (args[1].find("../") != std::string::npos)) {
|
||||||
return Error() << "file name must not be relative";
|
return Error() << "file name must not be relative";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue