summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/FuzzerShmemPosix.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerShmemPosix.cpp')
-rw-r--r--llvm/lib/Fuzzer/FuzzerShmemPosix.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerShmemPosix.cpp b/llvm/lib/Fuzzer/FuzzerShmemPosix.cpp
index 820d64d07c1..d5f4aabc426 100644
--- a/llvm/lib/Fuzzer/FuzzerShmemPosix.cpp
+++ b/llvm/lib/Fuzzer/FuzzerShmemPosix.cpp
@@ -86,9 +86,13 @@ void SharedMemoryRegion::Post(int Idx) {
void SharedMemoryRegion::Wait(int Idx) {
assert(Idx == 0 || Idx == 1);
- if (sem_wait((sem_t*)Semaphore[Idx])) {
- Printf("ERROR: sem_wait failed\n");
- exit(1);
+ for (int i = 0; i < 10 && sem_wait((sem_t*)Semaphore[Idx]); i++) {
+ // sem_wait may fail if interrupted by a signal.
+ sleep(i);
+ if (i)
+ Printf("%s: sem_wait[%d] failed %s\n", i < 9 ? "WARNING" : "ERROR", i,
+ strerror(errno));
+ if (i == 9) abort();
}
}
OpenPOWER on IntegriCloud