================
@@ -321,14 +323,23 @@ static void RegisterHandlers() { // Not signal-safe.
NewHandler.sa_flags = SA_NODEFER | SA_RESETHAND | SA_ONSTACK |
SA_SIGINFO;
break;
case SignalKind::IsInfo:
- NewHandler.sa_handler = InfoSignalHandler;
+ if (NeedsPOSIXUtilitySignalHandling)
+ // If POSIX signal-handling semantics are followed, the signal handler
+ // resignal itself to terminate after handling the signal.
+ NewHandler.sa_handler = InfoSignalHandlerTerminate;
+ else
+ NewHandler.sa_handler = InfoSignalHandler;
NewHandler.sa_flags = SA_ONSTACK;
break;
}
sigemptyset(&NewHandler.sa_mask);
- // Install the new handler, save the old one in RegisteredSignalInfo.
- sigaction(Signal, &NewHandler, &RegisteredSignalInfo[Index].SA);
+ // Install the new handler if the signal disposition isn't SIG_IGN,
+ // save the old one in RegisteredSignalInfo.
+ struct sigaction act;
----------------
xingxue-ibm wrote:
I thought that if the signal disposition is explicitly set to `SIG_IGN`, it
should be honored. I agree that this patch should change the behavior of
`clang` only and not affect other utilities. Changed to guard the new behavior
with `NeedsPOSIXUtilitySignalHandling`.
https://github.com/llvm/llvm-project/pull/169340
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits