Skip fifos, sockets, .. when using --type f/d/l

This commit is contained in:
sharkdp 2018-03-15 20:45:26 +01:00 committed by David Peter
parent ffd49c60bd
commit 5397787824

View file

@ -203,6 +203,11 @@ pub fn scan(path_vec: &[PathBuf], pattern: Arc<Regex>, config: Arc<FdOptions>) {
|| (entry_type.is_symlink() && !file_types.symlinks) || (entry_type.is_symlink() && !file_types.symlinks)
{ {
return ignore::WalkState::Continue; return ignore::WalkState::Continue;
} else if !(entry_type.is_file() || entry_type.is_dir()
|| entry_type.is_symlink())
{
// This is probably a block device, char device, fifo or socket. Skip it.
return ignore::WalkState::Continue;
} }
} else { } else {
return ignore::WalkState::Continue; return ignore::WalkState::Continue;