Replace auto with explicit type declarations

PiperOrigin-RevId: 399419917
Change-Id: I4b7acd8ab6e2542e2971b29bed0745378b2b6743
This commit is contained in:
Sandboxed API Team 2021-09-28 05:50:19 -07:00 committed by Copybara-Service
parent 448f393c29
commit fb81c00fd1
4 changed files with 12 additions and 10 deletions

View File

@ -120,7 +120,7 @@ int main(int argc, char** argv) {
// Let the sandboxee run.
if (!s2.RunAsync()) {
auto result = s2.AwaitResult();
sandbox2::Result result = s2.AwaitResult();
LOG(ERROR) << "RunAsync failed: " << result.ToString();
return 2;
}
@ -141,7 +141,7 @@ int main(int argc, char** argv) {
}
}
auto result = s2.AwaitResult();
sandbox2::Result result = s2.AwaitResult();
if (result.final_status() != sandbox2::Result::OK) {
LOG(ERROR) << "Sandbox error: " << result.ToString();
return 3; // e.g. sandbox violation, signal (sigsegv)

View File

@ -86,7 +86,7 @@ static int SandboxIteration(sandbox2::ForkClient* fork_client, int32_t i) {
CHECK(s2.RunAsync());
// Send integer, which will be returned as the sandboxee's exit code.
CHECK(s2.comms()->SendInt32(i));
auto result = s2.AwaitResult();
sandbox2::Result result = s2.AwaitResult();
LOG(INFO) << "Final execution status of PID " << s2.GetPid() << ": "
<< result.ToString();

View File

@ -140,7 +140,7 @@ int main(int argc, char** argv) {
sandbox2::Sandbox2 s2(std::move(executor), std::move(policy));
// Let the sandboxee run (synchronously).
auto result = s2.Run();
sandbox2::Result result = s2.Run();
LOG(INFO) << "Final execution status: " << result.ToString();

View File

@ -15,7 +15,8 @@
// A simple sandbox2 testing tool.
//
// Usage:
// sandbox2tool -v=1 -sandbox2_danger_danger_permit_all -logtostderr -- /bin/ls
// sandbox2tool -v=1 -sandbox2tool_resolve_and_add_libraries \
// -sandbox2_danger_danger_permit_all -logtostderr /bin/ls
#include <sys/resource.h>
#include <sys/stat.h>
@ -155,12 +156,13 @@ int main(int argc, char** argv) {
builder.AddTmpfs("/tmp");
}
auto mounts_string = absl::GetFlag(FLAGS_sandbox2tool_additional_bind_mounts);
std::string mounts_string =
absl::GetFlag(FLAGS_sandbox2tool_additional_bind_mounts);
if (!mounts_string.empty()) {
for (auto mount : absl::StrSplit(mounts_string, ',')) {
for (absl::string_view mount : absl::StrSplit(mounts_string, ',')) {
std::vector<std::string> source_target = absl::StrSplit(mount, "=>");
auto source = source_target[0];
auto target = source_target[0];
std::string source = source_target[0];
std::string target = source_target[0];
if (source_target.size() == 2) {
target = source_target[1];
}
@ -218,7 +220,7 @@ int main(int argc, char** argv) {
LOG(ERROR) << "Sandbox failed";
}
auto result = s2.AwaitResult();
sandbox2::Result result = s2.AwaitResult();
if (result.final_status() != sandbox2::Result::OK) {
LOG(ERROR) << "Sandbox error: " << result.ToString();