Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scanner: don't skip directory entries with type DT_UNKNOWN #2703

Merged
merged 1 commit into from
May 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/mu-scanner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,13 @@ Scanner::Private::process_dir(const std::string& path, bool is_maildir)
while (running_) {
errno = 0;
if (const auto& dentry{::readdir(dir)}; dentry) {
#if HAVE_DIRENT_D_TYPE /* opttimization: filter out non-dirs early */
#if HAVE_DIRENT_D_TYPE /* optimization: filter out non-dirs early. NB not all file-systems support
* returning the file-type in `d_type`, so don't skip `DT_UNKNOWN`.
*/
if (maildirs_only_mode() &&
dentry->d_type != DT_DIR && dentry->d_type != DT_LNK)
dentry->d_type != DT_DIR &&
dentry->d_type != DT_LNK &&
dentry->d_type != DT_UNKNOWN)
continue;
#endif /*HAVE_DIRENT_D_TYPE*/
dir_entries.emplace_back(dentry);
Expand Down
Loading