Skip to content

Commit

Permalink
chore: Remove a string copy.
Browse files Browse the repository at this point in the history
Bug: N/A
Change-Id: I2197bd92d81c7f378c5f79719bd41bb0fd4a0bea
GitOrigin-RevId: 5b787781f46da4bc70ab2a58ad05cbcee86d2744
  • Loading branch information
Privacy Sandbox Team authored and copybara-github committed Oct 30, 2024
1 parent 3160ad4 commit cd2b18d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/roma/byob/container/run_workers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,8 @@ std::optional<PidExecutionTokenAndPivotRootDir> ConnectSendCloneAndExec(
PLOG(INFO) << "connect() to " << socket_name << " failed";
return std::nullopt;
}
char tmp_file[] = "/tmp/roma_app_server_XXXXXX";
const char* pivot_root_dir = ::mkdtemp(tmp_file);
if (pivot_root_dir == nullptr) {
std::string pivot_root_dir = "/tmp/roma_app_server_XXXXXX";
if (::mkdtemp(pivot_root_dir.data()) == nullptr) {
PLOG(ERROR) << "mkdtemp()";
return std::nullopt;
}
Expand Down Expand Up @@ -239,7 +238,7 @@ std::optional<PidExecutionTokenAndPivotRootDir> ConnectSendCloneAndExec(
return PidExecutionTokenAndPivotRootDir{
.pid = pid,
.execution_token = std::move(execution_token),
.pivot_root_dir = std::string(pivot_root_dir),
.pivot_root_dir = std::move(pivot_root_dir),
};
}
} // namespace
Expand Down

0 comments on commit cd2b18d

Please sign in to comment.