[Fuzzer] Make InterruptHandler non-blocking for Fuchsia
The initial naive approach to simulate SIGINT on Fuchsia was to getchar and look for ETX. This caused the InterruptHandler thread to lock stdin, preventing musl's exit() from being able to close the stdio descriptors and complete. This change uses select() instead. Patch By: aarongreen Differential Revision: https://reviews.llvm.org/D45636 llvm-svn: 330328
This commit is contained in:
parent
f8a92c1fff
commit
7a31c7ad23
|
@ -45,8 +45,13 @@ void AlarmHandler(int Seconds) {
|
|||
}
|
||||
|
||||
void InterruptHandler() {
|
||||
fd_set readfds;
|
||||
// Ctrl-C sends ETX in Zircon.
|
||||
while (getchar() != 0x03);
|
||||
do {
|
||||
FD_ZERO(&readfds);
|
||||
FD_SET(STDIN_FILENO, &readfds);
|
||||
select(STDIN_FILENO + 1, &readfds, nullptr, nullptr, nullptr);
|
||||
} while(!FD_ISSET(STDIN_FILENO, &readfds) || getchar() != 0x03);
|
||||
Fuzzer::StaticInterruptCallback();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue