1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

[Signal] Allow one-shot SIGPIPE handler to be reached

As SIGPIPE is no longer in the IntSigs array, handle SIGPIPE before
handling any interrupt signals.

Thanks to Alexandre Ganea for pointing out the issue here.
This commit is contained in:
Vedant Kumar 2019-12-04 19:21:14 -08:00
parent 4f5676a2c2
commit 8045961a33

View File

@ -361,16 +361,16 @@ static RETSIGTYPE SignalHandler(int Sig) {
{
RemoveFilesToRemove();
if (Sig == SIGPIPE)
if (auto OldOneShotPipeFunction =
OneShotPipeSignalFunction.exchange(nullptr))
return OldOneShotPipeFunction();
if (std::find(std::begin(IntSigs), std::end(IntSigs), Sig)
!= std::end(IntSigs)) {
if (auto OldInterruptFunction = InterruptFunction.exchange(nullptr))
return OldInterruptFunction();
if (Sig == SIGPIPE)
if (auto OldOneShotPipeFunction =
OneShotPipeSignalFunction.exchange(nullptr))
return OldOneShotPipeFunction();
raise(Sig); // Execute the default handler.
return;
}