diff --git a/sandboxed_api/sandbox2/BUILD.bazel b/sandboxed_api/sandbox2/BUILD.bazel index 3e3b691..2e562a3 100644 --- a/sandboxed_api/sandbox2/BUILD.bazel +++ b/sandboxed_api/sandbox2/BUILD.bazel @@ -499,7 +499,6 @@ cc_library( "//sandboxed_api/sandbox2/util:fileops", "//sandboxed_api/sandbox2/util:strerror", "//sandboxed_api/util:raw_logging", - "//sandboxed_api/util:status", "//sandboxed_api/util:statusor", "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/strings", diff --git a/sandboxed_api/sandbox2/forkserver.cc b/sandboxed_api/sandbox2/forkserver.cc index f25e848..21dca46 100644 --- a/sandboxed_api/sandbox2/forkserver.cc +++ b/sandboxed_api/sandbox2/forkserver.cc @@ -304,7 +304,10 @@ void ForkServer::LaunchChild(const ForkRequest& request, int execve_fd, // A custom init process is only needed if a new PID NS is created. if (request.clone_flags() & CLONE_NEWPID) { // Spawn a child process - pid_t child = fork(); + pid_t child; + { + child = fork(); + } if (child < 0) { SAPI_RAW_PLOG(FATAL, "Could not spawn init process"); } diff --git a/sandboxed_api/sandbox2/global_forkclient.cc b/sandboxed_api/sandbox2/global_forkclient.cc index bdcee27..c87d65b 100644 --- a/sandboxed_api/sandbox2/global_forkclient.cc +++ b/sandboxed_api/sandbox2/global_forkclient.cc @@ -77,7 +77,10 @@ static void StartGlobalForkServer() { "creating socket pair"); // Fork the fork-server, and clean-up the resources (close remote sockets). - pid_t pid = fork(); + pid_t pid; + { + pid = fork(); + } SAPI_RAW_PCHECK(pid != -1, "during fork"); // Parent. diff --git a/sandboxed_api/sandbox2/util.cc b/sandboxed_api/sandbox2/util.cc index d1c44f1..24d4a36 100644 --- a/sandboxed_api/sandbox2/util.cc +++ b/sandboxed_api/sandbox2/util.cc @@ -133,7 +133,10 @@ pid_t CloneAndJump(int flags, jmp_buf* env_ptr) { #else #error "Architecture is not supported" #endif - int r = clone(&ChildFunc, stack, flags, env_ptr, nullptr, nullptr, nullptr); + int r; + { + r = clone(&ChildFunc, stack, flags, env_ptr, nullptr, nullptr, nullptr); + } if (r == -1) { SAPI_RAW_PLOG(ERROR, "clone()"); }