MCPcopy Create free account
hub / github.com/PLSysSec/wave / resolve_path

Function resolve_path

src/path_resolution.rs:68–87  ·  view source on GitHub ↗
(path: Vec<u8>, should_follow: bool, dirfd: HostFd)

Source from the content-addressed store, hash-verified

66 }
67)]
68pub fn resolve_path(path: Vec<u8>, should_follow: bool, dirfd: HostFd) -> RuntimeResult<HostPath> {
69 // TODO: use ? when that works properly in Prusti
70 let c = expand_path(path, should_follow, dirfd);
71
72 let c = match c {
73 Ok(oc) => oc,
74 Err(e) => {
75 return Err(e);
76 }
77 };
78
79 if c.len() <= 0 || !is_relative(&c) || min_depth(&c) < 0 {
80 return Err(RuntimeError::Enotcapable);
81 }
82
83 match OwnedComponents::unparse(c) {
84 Some(result_arr) => Ok(result_arr),
85 _ => Err(RuntimeError::Enametoolong),
86 }
87}
88
89// Recursively expands a symlink (without explicit recursion)
90// maintains a queue of path components to process

Callers 1

translate_pathMethod · 0.85

Calls 4

expand_pathFunction · 0.85
is_relativeFunction · 0.85
min_depthFunction · 0.85
lenMethod · 0.45

Tested by

no test coverage detected