summaryrefslogtreecommitdiffstats
path: root/src/aggregate.rs
diff options
context:
space:
mode:
authorSebastian Thiel <sebastian.thiel@icloud.com>2020-03-27 21:26:23 +0800
committerSebastian Thiel <sebastian.thiel@icloud.com>2020-03-27 21:26:23 +0800
commit768cbce3963be7d6ece448d56289223810d678ac (patch)
treef56cb2355ad058c7a228b70505ffd1eb440698c7 /src/aggregate.rs
parent2bbbb0b42371e0701af3b927fee129cd8be5a852 (diff)
Truly don't follow symlinks unless they are the only top-level path.v2.3.9
This is a brute-force hack which won't show them at all, there certainly is better ways if we would know if we expanded paths ourselves or not.
Diffstat (limited to 'src/aggregate.rs')
-rw-r--r--src/aggregate.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/aggregate.rs b/src/aggregate.rs
index 101e45b..538950a 100644
--- a/src/aggregate.rs
+++ b/src/aggregate.rs
@@ -22,7 +22,17 @@ pub fn aggregate(
let mut num_roots = 0;
let mut aggregates = Vec::new();
let mut inodes = InodeFilter::default();
+ let paths: Vec<_> = paths.into_iter().collect();
+ let input_len = paths.len();
for path in paths.into_iter() {
+ // For now, bluntly ignore symlinks that are on the top-level, and there are more roots to follow
+ if input_len > 1 {
+ if let Ok(meta) = path.as_ref().symlink_metadata() {
+ if meta.file_type().is_symlink() {
+ continue;
+ }
+ }
+ }
num_roots += 1;
let mut num_bytes = 0u64;
let mut num_errors = 0u64;