MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / debugfs_quote_argument

Function debugfs_quote_argument

crates/openshell-driver-vm/src/rootfs.rs:609–626  ·  view source on GitHub ↗
(argument: &str)

Source from the content-addressed store, hash-verified

607}
608
609fn debugfs_quote_argument(argument: &str) -> Option<String> {
610 if argument.is_empty() {
611 return None;
612 }
613
614 let mut quoted = String::with_capacity(argument.len() + 2);
615 quoted.push('"');
616 for ch in argument.chars() {
617 match ch {
618 '\0' | '\n' | '\r' => return None,
619 '\\' => quoted.push_str("\\\\"),
620 '"' => quoted.push_str("\\\""),
621 _ => quoted.push(ch),
622 }
623 }
624 quoted.push('"');
625 Some(quoted)
626}
627
628fn sandbox_guest_user_ids(rootfs: &Path) -> Result<Option<(u32, u32)>, String> {
629 let passwd_path = rootfs.join("etc/passwd");

Callers 2

write_rootfs_image_fileFunction · 0.85

Calls 3

lenMethod · 0.80
pushMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected