Skip to content

Commit

Permalink
remove a unnecessary calls to clone() by limiting the lifetime.
Browse files Browse the repository at this point in the history
  • Loading branch information
utam0k committed Oct 16, 2021
1 parent 66c2eab commit 131c16e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/container/builder_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ impl<'a> ContainerBuilderImpl<'a> {
let container_args = ContainerArgs {
init: self.init,
syscall: self.syscall,
spec: self.spec.clone(),
rootfs: self.rootfs.clone(),
spec: self.spec,
rootfs: &self.rootfs,
console_socket: self.console_socket,
notify_socket,
preserve_fds: self.preserve_fds,
container: self.container.clone(),
rootless: self.rootless.clone(),
container: &self.container,
rootless: &self.rootless,
cgroup_manager: cmanager,
};

Expand Down
8 changes: 4 additions & 4 deletions src/process/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ pub struct ContainerArgs<'a> {
/// Interface to operating system primitives
pub syscall: &'a dyn Syscall,
/// OCI complient runtime spec
pub spec: Spec,
pub spec: &'a Spec,
/// Root filesystem of the container
pub rootfs: PathBuf,
pub rootfs: &'a PathBuf,
/// Socket to communicate the file descriptor of the ptty
pub console_socket: Option<RawFd>,
/// The Unix Domain Socket to communicate container start
pub notify_socket: NotifyListener,
/// File descriptos preserved/passed to the container init process.
pub preserve_fds: i32,
/// Container state
pub container: Option<Container>,
pub container: &'a Option<Container>,
/// Options for rootless containers
pub rootless: Option<Rootless<'a>>,
pub rootless: &'a Option<Rootless<'a>>,
/// Cgroup Manager
pub cgroup_manager: Box<dyn CgroupManager>,
}
2 changes: 1 addition & 1 deletion src/process/container_init_process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ pub fn container_init_process(
}
};

set_supplementary_gids(proc.user(), &args.rootless)
set_supplementary_gids(proc.user(), args.rootless)
.context("failed to set supplementary gids")?;

syscall
Expand Down

0 comments on commit 131c16e

Please sign in to comment.