aboutsummaryrefslogtreecommitdiff
path: root/libfuzzer/FuzzerIOWindows.cpp
diff options
context:
space:
mode:
authorJoel Galenson <jgalenson@google.com>2021-04-01 17:09:16 -0700
committerJoel Galenson <jgalenson@google.com>2021-04-01 17:09:16 -0700
commitd1325ea49959305aec6fa54768f6d694aae3e4b7 (patch)
treeb40cfd9e8802b2879a81663220a69c0d24691ebf /libfuzzer/FuzzerIOWindows.cpp
parent31b9bb6b3b73523edfbea46e3e490e403c1a17d4 (diff)
downloadlibfuzzer-sys-d1325ea49959305aec6fa54768f6d694aae3e4b7.tar.gz
Upgrade rust/crates/libfuzzer-sys to 0.4.0android-s-beta-2android-s-beta-1
Test: make Change-Id: I0411b0aba37380808fc84ad2dfcde2f57560e789
Diffstat (limited to 'libfuzzer/FuzzerIOWindows.cpp')
-rw-r--r--libfuzzer/FuzzerIOWindows.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/libfuzzer/FuzzerIOWindows.cpp b/libfuzzer/FuzzerIOWindows.cpp
index 651283a..61ad35e 100644
--- a/libfuzzer/FuzzerIOWindows.cpp
+++ b/libfuzzer/FuzzerIOWindows.cpp
@@ -76,6 +76,18 @@ static bool IsDir(DWORD FileAttrs) {
return FileAttrs & FILE_ATTRIBUTE_DIRECTORY;
}
+bool IsDirectory(const std::string &Path) {
+ DWORD Att = GetFileAttributesA(Path.c_str());
+
+ if (Att == INVALID_FILE_ATTRIBUTES) {
+ Printf("GetFileAttributesA() failed for \"%s\" (Error code: %lu).\n",
+ Path.c_str(), GetLastError());
+ return false;
+ }
+
+ return IsDir(Att);
+}
+
std::string Basename(const std::string &Path) {
size_t Pos = Path.find_last_of("/\\");
if (Pos == std::string::npos) return Path;
@@ -227,7 +239,7 @@ intptr_t GetHandleFromFd(int fd) {
return _get_osfhandle(fd);
}
-static bool IsSeparator(char C) {
+bool IsSeparator(char C) {
return C == '\\' || C == '/';
}