mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-13 14:46:15 +00:00
[libFuzzer] Avoid name collision with Windows API.
Windows uses some macros to replace DeleteFile() by DeleteFileA() or DeleteFileW(). This was causing an error at link time. DeleteFile was renamed to RemoveFile(). Differential Revision: https://reviews.llvm.org/D27577 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289563 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
fed659a90c
commit
fae92e9e69
@ -119,7 +119,7 @@ class InputCorpus {
|
|||||||
void DeleteInput(size_t Idx) {
|
void DeleteInput(size_t Idx) {
|
||||||
InputInfo &II = *Inputs[Idx];
|
InputInfo &II = *Inputs[Idx];
|
||||||
if (!OutputCorpus.empty() && II.MayDeleteFile)
|
if (!OutputCorpus.empty() && II.MayDeleteFile)
|
||||||
DeleteFile(DirPlusFile(OutputCorpus, Sha1ToString(II.Sha1)));
|
RemoveFile(DirPlusFile(OutputCorpus, Sha1ToString(II.Sha1)));
|
||||||
Unit().swap(II.U);
|
Unit().swap(II.U);
|
||||||
if (FeatureDebug)
|
if (FeatureDebug)
|
||||||
Printf("EVICTED %zd\n", Idx);
|
Printf("EVICTED %zd\n", Idx);
|
||||||
|
@ -57,7 +57,7 @@ int CloseFile(int Fd);
|
|||||||
|
|
||||||
int DuplicateFile(int Fd);
|
int DuplicateFile(int Fd);
|
||||||
|
|
||||||
void DeleteFile(const std::string &Path);
|
void RemoveFile(const std::string &Path);
|
||||||
|
|
||||||
} // namespace fuzzer
|
} // namespace fuzzer
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ int DuplicateFile(int Fd) {
|
|||||||
return dup(Fd);
|
return dup(Fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeleteFile(const std::string &Path) {
|
void RemoveFile(const std::string &Path) {
|
||||||
unlink(Path.c_str());
|
unlink(Path.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ int DuplicateFile(int Fd) {
|
|||||||
return _dup(Fd);
|
return _dup(Fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeleteFile(const std::string &Path) {
|
void RemoveFile(const std::string &Path) {
|
||||||
_unlink(Path.c_str());
|
_unlink(Path.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ void Fuzzer::CrashResistantMerge(const std::vector<std::string> &Args,
|
|||||||
std::string CFPath =
|
std::string CFPath =
|
||||||
"libFuzzerTemp." + std::to_string(GetPid()) + ".txt";
|
"libFuzzerTemp." + std::to_string(GetPid()) + ".txt";
|
||||||
// Write the control file.
|
// Write the control file.
|
||||||
DeleteFile(CFPath);
|
RemoveFile(CFPath);
|
||||||
std::ofstream ControlFile(CFPath);
|
std::ofstream ControlFile(CFPath);
|
||||||
ControlFile << AllFiles.size() << "\n";
|
ControlFile << AllFiles.size() << "\n";
|
||||||
ControlFile << NumFilesInFirstCorpus << "\n";
|
ControlFile << NumFilesInFirstCorpus << "\n";
|
||||||
@ -253,7 +253,7 @@ void Fuzzer::CrashResistantMerge(const std::vector<std::string> &Args,
|
|||||||
for (auto &F: NewFiles)
|
for (auto &F: NewFiles)
|
||||||
WriteToOutputCorpus(FileToVector(F));
|
WriteToOutputCorpus(FileToVector(F));
|
||||||
// We are done, delete the control file.
|
// We are done, delete the control file.
|
||||||
DeleteFile(CFPath);
|
RemoveFile(CFPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace fuzzer
|
} // namespace fuzzer
|
||||||
|
Loading…
x
Reference in New Issue
Block a user