(path: Vec<u8>, should_follow: bool, dirfd: HostFd)
| 66 | } |
| 67 | )] |
| 68 | pub 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 |
no test coverage detected