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/aggregate.rs | |
parent | 5b696d46bf923f5eb0c7d7b3935e35695dc16318 (diff) |
jwalk 0.5 has landed - now we don't follow symlinks during traversal!
Diffstat (limited to 'src/aggregate.rs')
-rw-r--r-- | src/aggregate.rs | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/aggregate.rs b/src/aggregate.rs index 0652a03..414a9c0 100644 --- a/src/aggregate.rs +++ b/src/aggregate.rs @@ -29,26 +29,27 @@ pub fn aggregate( stats.entries_traversed += 1; match entry { Ok(entry) => { - let file_size = match entry.metadata { - Some(Ok(ref m)) if !m.is_dir() && (options.count_hard_links || inodes.add(m)) => { + let file_size = match entry.client_state { + Some(Ok(ref m)) + if !m.is_dir() && (options.count_hard_links || inodes.add(m)) => + { if options.apparent_size { m.len() } else { - filesize::file_real_size_fast(&entry.path(), m) - .unwrap_or_else(|_| { + filesize::file_real_size_fast(&entry.path(), m).unwrap_or_else( + |_| { num_errors += 1; 0 - }) + }, + ) } - }, + } Some(Ok(_)) => 0, Some(Err(_)) => { num_errors += 1; 0 } - None => unreachable!( - "we ask for metadata, so we at least have Some(Err(..))). Issue in jwalk?" - ), + None => unreachable!("must have populated client state for metadata"), }; stats.largest_file_in_bytes = stats.largest_file_in_bytes.max(file_size); stats.smallest_file_in_bytes = stats.smallest_file_in_bytes.min(file_size); |