//===- FuzzerIOPosix.cpp - IO utils for Posix. ----------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // IO functions implementation using Posix API. //===----------------------------------------------------------------------===// #include"mozilla/Unused.h" #include"FuzzerPlatform.h" #if LIBFUZZER_POSIX || LIBFUZZER_FUCHSIA
int ListFilesInDirRecursive(const std::string &Dir, long *Epoch,
Vector<std::string> *V, bool TopDir) { auto E = GetEpoch(Dir); if (Epoch) if (E && *Epoch >= E) return 0;
DIR *D = opendir(Dir.c_str()); if (!D) {
Printf("%s: %s; exiting\n", strerror(errno), Dir.c_str()); return 1;
} while (auto E = readdir(D)) {
std::string Path = DirPlusFile(Dir, E->d_name); if (E->d_type == DT_REG || E->d_type == DT_LNK ||
(E->d_type == DT_UNKNOWN && IsFile(Path)))
V->push_back(Path); elseif ((E->d_type == DT_DIR ||
(E->d_type == DT_UNKNOWN && IsDirectory(Path))) &&
*E->d_name != '.') { int Res = ListFilesInDirRecursive(Path, Epoch, V, false); if (Res != 0) return Res;
}
}
closedir(D); if (Epoch && TopDir)
*Epoch = E; return 0;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.