[PATCH] D46622: wrong usages of sem_open in the libFuzzer
Yang Zheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 8 19:40:15 PDT 2018
tomsun.0.7 updated this revision to Diff 145845.
tomsun.0.7 edited the summary of this revision.
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D46622
Files:
lib/fuzzer/FuzzerShmemPosix.cpp
test/fuzzer/equivalence-signals.test
Index: test/fuzzer/equivalence-signals.test
===================================================================
--- test/fuzzer/equivalence-signals.test
+++ test/fuzzer/equivalence-signals.test
@@ -7,7 +7,7 @@
UNSUPPORTED: darwin
RUN: %cpp_compiler %S/EquivalenceATest.cpp -o %t-EquivalenceATest
-RUN: %t-EquivalenceATest -timeout=1 -run_equivalence_server=EQUIV_SIG_TEST & export APID=$!
+RUN: %t-EquivalenceATest -timeout=1 -run_equivalence_server=EQ_SIG_TEST & export APID=$!
RUN: sleep 3
-RUN: %t-EquivalenceATest -timeout=1 -use_equivalence_server=EQUIV_SIG_TEST -runs=500000 2>&1
+RUN: %t-EquivalenceATest -timeout=1 -use_equivalence_server=EQ_SIG_TEST -runs=500000 2>&1
RUN: kill -9 $APID
Index: lib/fuzzer/FuzzerShmemPosix.cpp
===================================================================
--- lib/fuzzer/FuzzerShmemPosix.cpp
+++ lib/fuzzer/FuzzerShmemPosix.cpp
@@ -32,6 +32,8 @@
std::string SharedMemoryRegion::SemName(const char *Name, int Idx) {
std::string Res(Name);
+ if (!Res.empty() && Res[0] != '/')
+ Res.insert(Res.begin(), '/');
return Res + (char)('0' + Idx);
}
@@ -52,7 +54,7 @@
for (int i = 0; i < 2; i++) {
sem_unlink(SemName(Name, i).c_str());
Semaphore[i] = sem_open(SemName(Name, i).c_str(), O_CREAT, 0644, 0);
- if (Semaphore[i] == (void *)-1)
+ if (Semaphore[i] == SEM_FAILED)
return false;
}
IAmServer = true;
@@ -70,7 +72,7 @@
return false;
for (int i = 0; i < 2; i++) {
Semaphore[i] = sem_open(SemName(Name, i).c_str(), 0);
- if (Semaphore[i] == (void *)-1)
+ if (Semaphore[i] == SEM_FAILED)
return false;
}
IAmServer = false;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46622.145845.patch
Type: text/x-patch
Size: 1650 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180509/6cee8288/attachment.bin>
More information about the llvm-commits
mailing list