[llvm-branch-commits] [llvm] bf40125 - [Signal] Re-raise SIGPIPE if the handler is uninstalled
Vedant Kumar via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Jan 8 11:18:53 PST 2021
Author: Vedant Kumar
Date: 2021-01-08T11:13:43-08:00
New Revision: bf401256edd00e921a5d3a0bf4cf6ee66ae51cd6
URL: https://github.com/llvm/llvm-project/commit/bf401256edd00e921a5d3a0bf4cf6ee66ae51cd6
DIFF: https://github.com/llvm/llvm-project/commit/bf401256edd00e921a5d3a0bf4cf6ee66ae51cd6.diff
LOG: [Signal] Re-raise SIGPIPE if the handler is uninstalled
Instead of falling through to RunSignalHandlers after the SIGPIPE
handler is uninstalled and we get a SIGPIPE, re-raise the signal, just
like we do for other IntSigs.
This was discussed and informally OK'd here:
https://reviews.llvm.org/rG9a3f892d018238dce5181e458905311db8e682f5#856804
Added:
Modified:
llvm/lib/Support/Unix/Signals.inc
Removed:
################################################################################
diff --git a/llvm/lib/Support/Unix/Signals.inc b/llvm/lib/Support/Unix/Signals.inc
index 1ac2e090dcb8..3d7b5d2fe5aa 100644
--- a/llvm/lib/Support/Unix/Signals.inc
+++ b/llvm/lib/Support/Unix/Signals.inc
@@ -382,13 +382,15 @@ static RETSIGTYPE SignalHandler(int Sig) {
OneShotPipeSignalFunction.exchange(nullptr))
return OldOneShotPipeFunction();
- if (llvm::is_contained(IntSigs, Sig)) {
+ bool IsIntSig = llvm::is_contained(IntSigs, Sig);
+ if (IsIntSig)
if (auto OldInterruptFunction = InterruptFunction.exchange(nullptr))
return OldInterruptFunction();
- raise(Sig); // Execute the default handler.
+ if (Sig == SIGPIPE || IsIntSig) {
+ raise(Sig); // Execute the default handler.
return;
- }
+ }
}
// Otherwise if it is a fault (like SEGV) run any handler.
More information about the llvm-branch-commits
mailing list