mirror of
https://github.com/uutils/findutils.git
synced 2026-06-10 15:48:30 -07:00
find: Fix -fstype with stacked mounts
If you stack two mounts on top of each other, e.g.
# mount -t ext4 /dev/sdX /mnt
# mount -t f2fs /dev/sdY /mnt
then read_fs_list() will return two entries for that mount point. The
later one is the one with the correct type, since the later mount is on
top of the earlier one.
This commit is contained in:
@@ -53,7 +53,8 @@ pub fn get_file_system_type(path: &Path, cache: &RefCell<Option<Cache>>) -> URes
|
||||
let fs_list = uucore::fsext::read_fs_list()?;
|
||||
let result = fs_list
|
||||
.into_iter()
|
||||
.find(|fs| fs.dev_id == dev_id)
|
||||
.filter(|fs| fs.dev_id == dev_id)
|
||||
.next_back()
|
||||
.map_or_else(String::new, |fs| fs.fs_type);
|
||||
|
||||
// cache the latest query if not a match before
|
||||
|
||||
@@ -451,7 +451,8 @@ fn format_directive<'entry>(
|
||||
uucore::fsext::read_fs_list().expect("Could not find the filesystem info");
|
||||
fs_list
|
||||
.into_iter()
|
||||
.find(|fs| fs.dev_id == dev_id)
|
||||
.filter(|fs| fs.dev_id == dev_id)
|
||||
.next_back()
|
||||
.map_or_else(String::new, |fs| fs.fs_type)
|
||||
.into()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user