Index: lib/fuzzer/FuzzerIOPosix.cpp =================================================================== --- lib/fuzzer/FuzzerIOPosix.cpp +++ lib/fuzzer/FuzzerIOPosix.cpp @@ -32,6 +32,13 @@ return S_ISREG(St.st_mode); } +static bool IsDirectory(const std::string &Path) { + struct stat St; + if (stat(Path.c_str(), &St)) + return false; + return S_ISDIR(St.st_mode); +} + size_t FileSize(const std::string &Path) { struct stat St; if (stat(Path.c_str(), &St)) @@ -52,9 +59,12 @@ } while (auto E = readdir(D)) { std::string Path = DirPlusFile(Dir, E->d_name); - if (E->d_type == DT_REG || E->d_type == DT_LNK) + if (E->d_type == DT_REG || E->d_type == DT_LNK || + (E->d_type == DT_UNKNOWN && IsFile(Path))) V->push_back(Path); - else if (E->d_type == DT_DIR && *E->d_name != '.') + else if ((E->d_type == DT_DIR || + (E->d_type == DT_UNKNOWN && IsDirectory(Path))) && + *E->d_name != '.') ListFilesInDirRecursive(Path, Epoch, V, false); } closedir(D);