Fix bug for devices and apparent size

If apparent_size was set and ignore files on other devices was set then
the latter flat would not work.

Fix this bug
This commit is contained in:
andy.boot
2020-02-09 13:41:58 +00:00
parent 2082141dfc
commit b6aa1378de
+13 -11
View File
@@ -173,17 +173,19 @@ fn should_ignore_file(
inodes: &mut HashSet<(u64, u64)>, inodes: &mut HashSet<(u64, u64)>,
maybe_inode: Option<(u64, u64)>, maybe_inode: Option<(u64, u64)>,
) -> bool { ) -> bool {
if !apparent_size {
if let Some(inode_dev_pair) = maybe_inode { if let Some(inode_dev_pair) = maybe_inode {
// Ignore files on different devices (if flag applied) // Ignore files on different devices (if flag applied)
if restricted_filesystems.is_some() if restricted_filesystems.is_some()
&& !restricted_filesystems && !restricted_filesystems
.as_ref() .as_ref()
.unwrap() .unwrap()
.contains(&inode_dev_pair.1) .contains(&inode_dev_pair.1)
{ {
return true; return true;
} }
if !apparent_size {
// Ignore files already visited or symlinked // Ignore files already visited or symlinked
if inodes.contains(&inode_dev_pair) { if inodes.contains(&inode_dev_pair) {
return true; return true;