mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Refactoring for internal change
PiperOrigin-RevId: 320612442 Change-Id: I65729ac5d83c76dac047a47f866b7ad4af3c56c1
This commit is contained in:
parent
c3861819bc
commit
63a8b3ff15
|
@ -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",
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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()");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user