diff options
author | Sebastian Thiel <sebastian.thiel@icloud.com> | 2020-03-16 07:23:42 +0800 |
---|---|---|
committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2020-03-16 07:23:42 +0800 |
commit | 0d6116eea1e741bc8bc1fc6d04536c8242c5aa42 (patch) | |
tree | cae291c7f26f429c0c00a87be9b8aa12b867f14e /src/traverse.rs | |
parent | 5b696d46bf923f5eb0c7d7b3935e35695dc16318 (diff) |
jwalk 0.5 has landed - now we don't follow symlinks during traversal!
Diffstat (limited to 'src/traverse.rs')
-rw-r--r-- | src/traverse.rs | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/src/traverse.rs b/src/traverse.rs index a65595e..064fcd4 100644 --- a/src/traverse.rs +++ b/src/traverse.rs @@ -93,29 +93,31 @@ impl Traversal { } else { entry.file_name }; - let file_size = match entry.metadata { - Some(Ok(ref m)) if !m.is_dir() && (walk_options.count_hard_links || inodes.add(m)) => { - if walk_options.apparent_size { - m.len() - } else { - filesize::file_real_size_fast(&data.name, m) - .unwrap_or_else(|_| { - t.io_errors += 1; - data.metadata_io_error = true; - 0 - }) - } - }, - Some(Ok(_)) => 0, - Some(Err(_)) => { - t.io_errors += 1; - data.metadata_io_error = true; - 0 + let file_size = match entry.client_state { + Some(Ok(ref m)) + if !m.is_dir() + && (walk_options.count_hard_links || inodes.add(m)) => + { + if walk_options.apparent_size { + m.len() + } else { + filesize::file_real_size_fast(&data.name, m).unwrap_or_else( + |_| { + t.io_errors += 1; + data.metadata_io_error = true; + 0 + }, + ) } - None => unreachable!( - "we ask for metadata, so we at least have Some(Err(..))). Issue in jwalk?" - ), - }; + } + Some(Ok(_)) => 0, + Some(Err(_)) => { + t.io_errors += 1; + data.metadata_io_error = true; + 0 + } + None => unreachable!("must have populated client state for metadata"), + }; match (entry.depth, previous_depth) { (n, p) if n > p => { |