mirror of https://github.com/djcb/mu.git
scanner: don't skip directory entries with type `DT_UNKNOWN`
According to the readdir(2) man-page, not all file-systems support returning the entry's file-type in `d_type`. For example, the reprotest reproducibility tool, uses the disorderfs FUSE file-system to shuffle the order in which directory entries are returned, and this does not set `d_type`. Therefore, in addition to entries with type `DT_DIR` and `DT_LNK`, also process entries with type `DT_UNKNOWN`. Signed-off-by: Jeremy Sowden <azazel@debian.org>
This commit is contained in:
parent
808d725254
commit
5a1ca77b47
|
@ -215,9 +215,13 @@ Scanner::Private::process_dir(const std::string& path, bool is_maildir)
|
||||||
while (running_) {
|
while (running_) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
if (const auto& dentry{::readdir(dir)}; dentry) {
|
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() &&
|
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;
|
continue;
|
||||||
#endif /*HAVE_DIRENT_D_TYPE*/
|
#endif /*HAVE_DIRENT_D_TYPE*/
|
||||||
dir_entries.emplace_back(dentry);
|
dir_entries.emplace_back(dentry);
|
||||||
|
|
Loading…
Reference in New Issue