Skip to content

Commit 0113e72

Browse files
committed
Update comment, fix cargo-clippy warning
1 parent 0f9d43d commit 0113e72

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

Diff for: src/create.rs

+6-9
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ use crate::tty;
2020
use crate::utils;
2121
use crate::{capabilities, command::Command};
2222

23-
24-
/// This is the main structure which stores various commandline options given by
23+
/// This is the main structure which stores various commandline options given by
2524
/// high-level container runtime
2625
#[derive(Clap, Debug)]
2726
pub struct Create {
@@ -41,7 +40,7 @@ pub struct Create {
4140

4241
// One thing to note is that in the end, container is just another process in Linux
4342
// it has specific/different control group, namespace, using which program executing in it
44-
// can be given impression that is is running on a complete system, but on the system which
43+
// can be given impression that is is running on a complete system, but on the system which
4544
// it is running, it is just another process, and has attributes such as pid, file descriptors, etc.
4645
// associated with it like any other process.
4746
impl Create {
@@ -66,7 +65,8 @@ impl Create {
6665
fs::copy("config.json", container_dir.join("config.json"))?;
6766
log::debug!("spec: {:?}", spec);
6867

69-
// convert path to absolute path
68+
// convert path to absolute path, as relative path will be evaluated
69+
// relative to where youki command is executed, and will be difficult to manipulate
7070
let container_dir = fs::canonicalize(container_dir)?;
7171
unistd::chdir(&*container_dir)?;
7272

@@ -82,10 +82,8 @@ impl Create {
8282
container.save()?;
8383

8484
let mut notify_socket: NotifyListener = NotifyListener::new(&container_dir)?;
85-
8685
// convert path of root file system of the container to absolute path
8786
let rootfs = fs::canonicalize(&spec.root.path)?;
88-
8987
// if socket file path is given in commandline options,
9088
// get file descriptors of console and console socket
9189
let (csocketfd, _consolefd) = {
@@ -126,11 +124,10 @@ fn run_container<P: AsRef<Path>>(
126124
container: Container,
127125
command: impl Command,
128126
) -> Result<Process> {
129-
130127
// disable core dump for the process, check https://man7.org/linux/man-pages/man2/prctl.2.html for more information
131128
prctl::set_dumpable(false).unwrap();
132129

133-
// get Linux specific section of OCI spec,
130+
// get Linux specific section of OCI spec,
134131
// refer https://github.com/opencontainers/runtime-spec/blob/master/config-linux.md for more information
135132
let linux = spec.linux.as_ref().unwrap();
136133
let namespaces: Namespaces = linux.namespaces.clone().into();
@@ -171,7 +168,7 @@ fn run_container<P: AsRef<Path>>(
171168

172169
// fork second time, which will later create container
173170
match fork::fork_init(child)? {
174-
Process::Child(child) => unreachable!(),
171+
Process::Child(_child) => unreachable!(),
175172
// This is actually the child process after fork
176173
Process::Init(mut init) => {
177174
// setup args and env vars as in the spec

0 commit comments

Comments
 (0)