Skip to content

Commit 7c1defd

Browse files
author
Marcos Pividori
committed
[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 llvm-svn: 289563
1 parent 67dfacd commit 7c1defd

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

llvm/lib/Fuzzer/FuzzerCorpus.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class InputCorpus {
119119
void DeleteInput(size_t Idx) {
120120
InputInfo &II = *Inputs[Idx];
121121
if (!OutputCorpus.empty() && II.MayDeleteFile)
122-
DeleteFile(DirPlusFile(OutputCorpus, Sha1ToString(II.Sha1)));
122+
RemoveFile(DirPlusFile(OutputCorpus, Sha1ToString(II.Sha1)));
123123
Unit().swap(II.U);
124124
if (FeatureDebug)
125125
Printf("EVICTED %zd\n", Idx);

llvm/lib/Fuzzer/FuzzerIO.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ int CloseFile(int Fd);
5757

5858
int DuplicateFile(int Fd);
5959

60-
void DeleteFile(const std::string &Path);
60+
void RemoveFile(const std::string &Path);
6161

6262
} // namespace fuzzer
6363

llvm/lib/Fuzzer/FuzzerIOPosix.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ int DuplicateFile(int Fd) {
7171
return dup(Fd);
7272
}
7373

74-
void DeleteFile(const std::string &Path) {
74+
void RemoveFile(const std::string &Path) {
7575
unlink(Path.c_str());
7676
}
7777

llvm/lib/Fuzzer/FuzzerIOWindows.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ int DuplicateFile(int Fd) {
135135
return _dup(Fd);
136136
}
137137

138-
void DeleteFile(const std::string &Path) {
138+
void RemoveFile(const std::string &Path) {
139139
_unlink(Path.c_str());
140140
}
141141

llvm/lib/Fuzzer/FuzzerMerge.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ void Fuzzer::CrashResistantMerge(const std::vector<std::string> &Args,
221221
std::string CFPath =
222222
"libFuzzerTemp." + std::to_string(GetPid()) + ".txt";
223223
// Write the control file.
224-
DeleteFile(CFPath);
224+
RemoveFile(CFPath);
225225
std::ofstream ControlFile(CFPath);
226226
ControlFile << AllFiles.size() << "\n";
227227
ControlFile << NumFilesInFirstCorpus << "\n";
@@ -253,7 +253,7 @@ void Fuzzer::CrashResistantMerge(const std::vector<std::string> &Args,
253253
for (auto &F: NewFiles)
254254
WriteToOutputCorpus(FileToVector(F));
255255
// We are done, delete the control file.
256-
DeleteFile(CFPath);
256+
RemoveFile(CFPath);
257257
}
258258

259259
} // namespace fuzzer

0 commit comments

Comments
 (0)