(
out_path: &mut OwnedComponents,
linkpath_components: OwnedComponents,
num_symlinks: &mut isize,
dirfd: HostFd,
)
| 93 | #[ensures(!is_symlink(out_path))] |
| 94 | #[ensures(forall(|i: usize| (i < out_path.len()) ==> !is_symlink(out_path.prefix(i)) ))] |
| 95 | fn expand_symlink( |
| 96 | out_path: &mut OwnedComponents, |
| 97 | linkpath_components: OwnedComponents, |
| 98 | num_symlinks: &mut isize, |
| 99 | dirfd: HostFd, |
| 100 | ) { |
| 101 | let mut idx = 0; |
| 102 | while idx < linkpath_components.len() { |
| 103 | body_invariant!(!is_symlink(out_path)); |
| 104 | // out_path should never contain symlinks |
| 105 | body_invariant!(forall(|i: usize| i < out_path.len() ==> !is_symlink(out_path.prefix(i)))); |
| 106 | if *num_symlinks >= MAXSYMLINKS { |
| 107 | return; |
| 108 | } |
| 109 | let c = linkpath_components.lookup(idx); |
| 110 | let maybe_linkpath = maybe_expand_component(dirfd, out_path, c, num_symlinks); |
| 111 | if let Some(linkpath) = maybe_linkpath { |
| 112 | expand_symlink(out_path, linkpath, num_symlinks, dirfd); |
| 113 | } |
| 114 | idx += 1; |
| 115 | } |
| 116 | } |
no test coverage detected