mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
use local variable instead of dynamic variable in TiffSapiSandbox::ModifyPolicy
This commit is contained in:
parent
bb871df80f
commit
b74b3c80fc
|
@ -31,8 +31,7 @@ class TiffSapiSandbox : public TiffSandbox {
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<sandbox2::Policy> ModifyPolicy(
|
std::unique_ptr<sandbox2::Policy> ModifyPolicy(
|
||||||
sandbox2::PolicyBuilder*) override {
|
sandbox2::PolicyBuilder*) override {
|
||||||
auto builder = std::make_unique<sandbox2::PolicyBuilder>();
|
sandbox2::PolicyBuilder builder = sandbox2::PolicyBuilder()
|
||||||
(*builder)
|
|
||||||
.AllowRead()
|
.AllowRead()
|
||||||
.AllowStaticStartup()
|
.AllowStaticStartup()
|
||||||
.AllowWrite()
|
.AllowWrite()
|
||||||
|
@ -51,14 +50,14 @@ class TiffSapiSandbox : public TiffSandbox {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (file_) {
|
if (file_) {
|
||||||
builder->AddFile(file_.value(), /*is_ro=*/false);
|
builder.AddFile(file_.value(), /*is_ro=*/false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dir_) {
|
if (dir_) {
|
||||||
builder->AddDirectory(dir_.value(), /*is_ro=*/false);
|
builder.AddDirectory(dir_.value(), /*is_ro=*/false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return builder.get()->BuildOrDie();
|
return builder.BuildOrDie();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<std::string> file_;
|
std::optional<std::string> file_;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user